Languages: English (English )German (Deutsch )French (Français )
Timezone: Europe/Zagreb (GMT+02:00)
Hi,
Thank you for contacting WPML support!
Your code does look correct to me, not sure what is missing.
Can you perhaps record a video using tool such as hidden link to show us once you hit the request and whether the prices got changed in the backend and frontend?
Is there any error message that shows up indicating that the request has failed?
Hi,
I tested this with a simple product by sending a PUT request to the endpoint /wp-json/wc/v3/products/36276, and it doesn't work either.
with this body:
{
"regular_price": "201",
"manage_stock": true,
"stock_status": "instock",
"stock_quantity": "1000",
"custom_prices": {
"PLN": {
"regular_price": 100
}
}
}
I also tried sending custom_prices.PLN.regular_price as a string instead of int
I can successfully update any value except custom_prices, there is a meta key _wcml_custom_prices_status in the output and it is always value 0
I have enabled multicurrency in WPML and can set a custom price manually, but not through the api.
I added the EUR currency and then added a test product.
Then in postman I made a PUT request with body
{
"regular_price": "202",
"manage_stock": true,
"stock_status": "instock",
"stock_quantity": "1000",
"custom_prices": {
"EUR": {
"regular_price": 100
}
}
}
Languages: English (English )German (Deutsch )French (Français )
Timezone: Europe/Zagreb (GMT+02:00)
We found this to be a bug in WPML but we have no fix for it yet.
But you can try this workaround:
1. Set the custom field `_wcml_custom_prices_status` to `1` to enable custom prices for the product.
2. Define the prices in USD if EUR is the default currency and USD is secondary. Use the keys `_regular_price_USD`, `_sale_price_USD`, and `_price_USD` for regular, sale, and actual prices respectively.
3. Send your product data. Ensure your request includes meta data for prices in different currencies.