Caleb Burks on "[Plugin: WooCommerce] How do I create product variations without generating new posts?"

ساخت وبلاگ

I have a website with several million posts (using a custom post type called "case"). They each have a lot of post_meta records (using ACF). I now want to transform them into woocommerce products. I'm using Reigel Gallarde's plugin which sets up woocommerce to treat any CPTs as products -- so far so good.

However, I want to use the exact same set of variations for each case/product without generating new variation post rows in wp_posts for each and every case. How can I define these variations in PHP alone or some other medium so I don't jam up the database with millions more rows? Is there a hook that would come in handy? I had trouble finding anything in WooCommerce docs.

When adding a variation to the cart, the add-to-cart.php REST call seems to require both the attribute slug (e.g., "&attribute_pa_color=orange") and the variation post ID ("&variation_id=48935701"), or else it won't add to the cart with the desired variation. The downfall here is that, in the database, the variation post ID is coupled (a child of) with the product post ID. I see that this is a good security practice, but it does not scale so well. If I could add an item to the cart with just with that attribute slug, that would be ideal.

You can reply to my question here or on StackOverflow:
http://stackoverflow.com/questions/38807958/how-do-i-create-woocommerce-product-variations-in-code-without-saving-new-record

https://wordpress.org/plugins/woocommerce/

WordPress ...
ما را در سایت WordPress دنبال می کنید

برچسب : نویسنده : استخدام کار wpss بازدید : 434 تاريخ : جمعه 22 مرداد 1395 ساعت: 0:06