yonish3
Forum Replies Created
-
Forum: Developing with WordPress
In reply to: Bulk import with unknown data structureparsing the data should be a challenge. So you suggest maybe usu SQL directly to the DB?
Any ideas about the sql code?
Don’t add arguments to the function declaration.
Use $product_id, which is part of the way WP works, to find the value you need.Maybe something like this:
$varible = get_field( 'field_name', $product_id );
Or
$product_id = get_the_ID(); $varible = get_post_meta( $product_id, 'field_name', true );
Or
global $product; $varible = get_field( 'field_name', $product->get_id() );
Or
global $product; $varible_2 = $product->get_attribute( 'attribute_name' );
It depends on wich file you add the code to.
I hope one of these will solve your issue.
Yes, this is what solved it for me.
I’m not a PHP WP developer, so it was a lot to search until I found something that worked for me.I hope it will help you as well, but I can say that for sure.
It seems that the issue was with ACF update the DB after the hook is triggered.
Therefore the value updated was always the value from the prevuis update.Have slved it using this function:
add_action('acf/save_post', 'woocommerce_update_product_acf_save_post', 1000, 1); function woocommerce_update_product_acf_save_post( $product_id ) { if (get_post_type($product_id) == "product") { remove_action('acf/save_post', 'woocommerce_update_product_acf_save_post'); update_on_product_save( $product_id ); } } function update_on_product_save( $product_id ) { do somthing }
Thanks, Margaret.
I tried adding the function code inside like this:
add_action( 'woocommerce_update_product', 'update_on_product_save', 1000, 1 ); function update_on_product_save($product_id, $product) { $updating_product_id = 'update_product_' . $product_id; if ( false === ( $updating_product = get_transient( $updating_product_id ) ) ) { // do something set_transient( $updating_product_id , $product_id, 2 ); } }
But it still doesn’t work.
I also don’t this it’s the issue.
According to the link you shared, the issue is that the function will run twice.
But the issue I have is that the function runs only after the second time I click the update button. i.e targeting the woocommerce_update_product hook.Forum: Plugins
In reply to: [WooCommerce] How to remove bulk products by ID from woocomarce using SQL?Have solved it using the REST API batch call.
But will still be glad if someone has this in SQL query, as the API takes some time and many resources.Forum: Plugins
In reply to: [WooCommerce] How to fix error ‘WooCommerce.get(…).then is not a function’?Apparently woocommerce.github.io are referring to @woocommerce/woocommerce-rest-api NPM package where /docs.woocommerce.com official website refer to woocommerce-api NPM package, which is out of support.
Kinda confusing…but that solves the mystery.
Make sure you are using the correct NPM package.
- This reply was modified 4 years, 7 months ago by yonish3.
Forum: Plugins
In reply to: [WooCommerce] How to fix filter widget is showing on Woocommerce page?Thanks for the input.
I actually don’t have that options under page attribute.I did manage to solve the issue. It was some settings under the theme that i missed. As you suspected.
Forum: Themes and Templates
In reply to: [Minamaze] Mess-up the slider picture dimension.any one?
Forum: Themes and Templates
In reply to: [Minamaze] Move the logo