REST API – Add meta_data with multiple values using same key
-
Hello, I am adding a new product via the REST API v2.
I am using a Wholesaler plugin that can restrict product visibility based on Wholesale Roles. This setting is saved on the backend in the meta data.
There are two roles that I would like to give access to: Wholesale Customer and Wholesale View Only. They are both present in the meta data, but only the last one gets added, or perhaps the first gets added, then overwritten by the second; I don’t know. The key in question is “wwpp_product_wholesale_visibility_filter”
Here is the meta_data part of my request:
{ "meta_data":[ { "key":"wholesale_customer_have_wholesale_price", "value":"yes" }, { "key":"wholesale_customer_wholesale_price", "value":"145" }, { "key":"wholesale_viewonly_have_wholesale_price", "value":"yes" }, { "key":"wholesale_viewonly_wholesale_price", "value":"145" }, { "key":"wwpp_post_meta_enable_quantity_discount_rule", "value":"yes" }, { "key":"wwpp_product_wholesale_visibility_filter", "value":"wholesale_customer" }, { "key":"wwpp_product_wholesale_visibility_filter", "value":"wholesale_viewonly" } ] }### WordPress Environment ### Home URL: https://dev.glaciernursery.com Site URL: https://dev.glaciernursery.com WC Version: 3.0.5 Log Directory Writable: ✔ WP Version: 4.7.4 WP Multisite: – WP Memory Limit: 128 MB WP Debug Mode: – WP Cron: ✔ Language: en_US ### Server Environment ### Server Info: Apache PHP Version: ❌ 5.4.45-0+deb7u8 - We recommend a minimum PHP version of 5.6. See: How to update your PHP version PHP Post Max Size: 48 MB PHP Time Limit: 96 PHP Max Input Vars: 1000 cURL Version: 7.26.0 OpenSSL/1.0.1t SUHOSIN Installed: – MySQL Version: ❌ 5.5.54 - We recommend a minimum MySQL version of 5.6. See: WordPress requirements Max Upload Size: 32 MB Default Timezone is UTC: ✔ fsockopen/cURL: ✔ SoapClient: ✔ DOMDocument: ✔ GZip: ✔ Multibyte String: ✔ Remote Post: ✔ Remote Get: ✔ ### Database ### WC Database Version: 3.0.5 WC Database Prefix: wp_ woocommerce_sessions: ✔ woocommerce_api_keys: ✔ woocommerce_attribute_taxonomies: ✔ woocommerce_downloadable_product_permissions: ✔ woocommerce_order_items: ✔ woocommerce_order_itemmeta: ✔ woocommerce_tax_rates: ✔ woocommerce_tax_rate_locations: ✔ woocommerce_shipping_zones: ✔ woocommerce_shipping_zone_locations: ✔ woocommerce_shipping_zone_methods: ✔ woocommerce_payment_tokens: ✔ woocommerce_payment_tokenmeta: ✔ MaxMind GeoIP Database: ✔ ### Security ### Secure connection (HTTPS): ✔ Hide errors from visitors: ✔ ### Active Plugins (11) ### Hello Dolly: by Matt Mullenweg – 1.6 Import GP Inventory: by MontanaSKy – 1.0 Really Simple SSL: by Rogier Lankhorst – 2.5.13 Fast Secure Contact Form: by Mike Challis Ken Carlson – 4.0.50 Tabs Responsive: by wpshopmart – 1.7.1 WooCommerce Wholesale Lead Capture: by Rymera Web Co – 1.6.10 WooCommerce Wholesale Order Form: by Rymera Web Co – 1.6.6 WooCommerce Wholesale Prices Premium: by Rymera Web Co – 1.14.5 WooCommerce Wholesale Prices: by Rymera Web Co – 1.4.5 WooCommerce: by Automattic – 3.0.5 Wordfence Security: by Wordfence – 6.3.8 ### Settings ### API Enabled: ✔ Force SSL: – Currency: USD ($) Currency Position: left Thousand Separator: , Decimal Separator: . Number of Decimals: 2 Taxonomies: Product Types: external (external) grouped (grouped) simple (simple) variable (variable) Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog) exclude-from-search (exclude-from-search) featured (featured) outofstock (outofstock) rated-1 (rated-1) rated-2 (rated-2) rated-3 (rated-3) rated-4 (rated-4) rated-5 (rated-5) ### WC Pages ### Shop base: #13 - /shop/ Cart: #15 - /cart/ Checkout: #17 - /checkout/ My account: #19 - /my-account/ ### Theme ### Name: Store Front Child Theme Version: 1.0.0 Author URL: Child Theme: ✔ Parent Theme Name: Storefront Parent Theme Version: 2.1.8 Parent Theme Author URL: https://woocommerce.com/ WooCommerce Support: ✔ ### Templates ### Overrides: –
The topic ‘REST API – Add meta_data with multiple values using same key’ is closed to new replies.