wc-api-custom-meta icon indicating copy to clipboard operation
wc-api-custom-meta copied to clipboard

Seems not to work in Woocommerce 3.0

Open DrunkenButGreat opened this issue 7 years ago • 3 comments

As described in https://wordpress.org/support/topic/does-not-work-for-woo-3-0/ it seem not to work in Woo 3.x (in my case 3.0.7). Setting custom_meta but saves nothing.

DrunkenButGreat avatar May 21 '17 11:05 DrunkenButGreat

Sorry, not had time to look at this yet.

Solution posted by Hinzaldi looks like a fix:

line 109:

replace $product_id = $product->id;

with: $product_id = $product->get_id();

In WC 3.0 you need to call an other method to get the ID

I'll try to get that released today.

judgej avatar May 31 '17 09:05 judgej

Hi.

The solution that you provided not working when retrieving a product though. I've not tested by setting a custom meta attribute. Here's https://pastebin.com/N8pWMSFM the output of: WooCommerce.get('products/14426', function(err, data, res) { console.log(res); });

Replaced the id with get_id as described. Please suggest.

ravimallya avatar Jun 19 '17 10:06 ravimallya

I have the same issue, with Woocommerce 3.1.1. I have applied the fix but it still doesn’t work. When I try to create a product with more than one variation, only one is created and I get the error ‘Fatal error: Uncaught Error: Cannot use object of type WC_Product_Variation as array…’

Any ideas?

Thanks in advance!

xinxo7 avatar Jul 31 '17 17:07 xinxo7