Title: Update / Refresh product with php
Last modified: July 20, 2018

---

# Update / Refresh product with php

 *  Resolved [Luca](https://wordpress.org/support/users/screenload/)
 * (@screenload)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/update-refresh-product-with-php/)
 * Hey guys,
 * I’m importing products and variations via PHP script.
    The variations get importet,
   and the options are shown in the backend as well.
 * But until I manually klick “update” in the backend of the product, the variations
   are not selectable in the front end.
 * Is there a way to “refresh” the product in PHP?

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [Peter Lawrenson](https://wordpress.org/support/users/lorro/)
 * (@lorro)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/update-refresh-product-with-php/#post-10511460)
 * Did you set the product post’s post_status field to “publish”.
 *  Thread Starter [Luca](https://wordpress.org/support/users/screenload/)
 * (@screenload)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/update-refresh-product-with-php/#post-10511545)
 * I did, but now I discovered something that seems to be the problem:
    The variations
   are there and the attributes are also in the correct field, but they are not ..
   like put togher?
 * **Screenshots:**
    [https://image.ibb.co/fKFzuJ/werte.png](https://image.ibb.co/fKFzuJ/werte.png)
   [https://image.ibb.co/eBacgy/variations.png](https://image.ibb.co/eBacgy/variations.png)
 * How do you tell woocommerce which options equal which variation with PHP?
    I 
   couldn’t find anything working online 🙁
 *  [Luminus Alabi](https://wordpress.org/support/users/luminus/)
 * (@luminus)
 * Automattic Happiness Engineer
 * [7 years, 9 months ago](https://wordpress.org/support/topic/update-refresh-product-with-php/#post-10551632)
 * [@screenload](https://wordpress.org/support/users/screenload/),
 * I’m not sure what you’re doing with that script and it is unlikely that anyone
   can tell you what is going on without looking at it.
 * Is there any reason you’re not using the REST API to do this?
 * You can see how to create a Product using the REST API here and there’s PHP Sample
   code that even covers variable products – [https://woocommerce.github.io/woocommerce-rest-api-docs/?php#create-a-product](https://woocommerce.github.io/woocommerce-rest-api-docs/?php#create-a-product).
 * When you’re importing products, you’re invariably creating them on the site that
   you’re importing them to and you may want to look at this.
 *  [Luminus Alabi](https://wordpress.org/support/users/luminus/)
 * (@luminus)
 * Automattic Happiness Engineer
 * [7 years, 9 months ago](https://wordpress.org/support/topic/update-refresh-product-with-php/#post-10576625)
 * [@screenload](https://wordpress.org/support/users/screenload/),
 * We haven’t heard back from you in a while, so I’m going to mark this as resolved–
   if you have any further questions, you can start a new thread.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Update / Refresh product with php’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce/assets/icon.svg?rev=3234504)
 * [WooCommerce](https://wordpress.org/plugins/woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce/reviews/)

 * 4 replies
 * 3 participants
 * Last reply from: [Luminus Alabi](https://wordpress.org/support/users/luminus/)
 * Last activity: [7 years, 9 months ago](https://wordpress.org/support/topic/update-refresh-product-with-php/#post-10576625)
 * Status: resolved