Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)
  • jordym

    (@jordym)

    What a wonderful day, I was so anoyed by this I finally looked into it. Glad most people are more annoyed than me. Beta fixed it ; )

    Thread Starter jordym

    (@jordym)

    Hi,

    I enabled the option, opened translate page, clicked String Translation, selected the ‘Regular” Tab.

    I can search and find the string, but when I edit it, I experience the same issue.

    The english content sits in the “From Dutch” field and it greyed out, I can enter an English and French translation, but can’t change the Dutch version.

    jordym

    (@jordym)

    Hi,

    I got it working with the following code =) Thanks for putting me on the correct path!

    function update_on_product_save($product_id) {
    
    	global $product;
    	$product = wc_get_product( $product_id );
    	$product_title = $product->get_name();
        $product_image_id = $product->get_image_id();
    Thread Starter jordym

    (@jordym)

    bump

    jordym

    (@jordym)

    I have been testing a bit; but i’m running into a weird issue;

    This code works, but then I have to drop some code as I have two arguments, besides Product ID, I also need Product, as I need the productname and product image id.

    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 );
    	}
    }
    
    ##add_action('woocommerce_update_product', 'action_on_product_save', 20, 2);
    
    function update_on_product_save($product_id) {

    So when I try it like,

    add_action('acf/save_post', 'woocommerce_update_product_acf_save_post', 1000, 2);
    
    function woocommerce_update_product_acf_save_post( $product_id, $product ) {
        if (get_post_type($product_id) == "product") {
    		remove_action('acf/save_post', 'woocommerce_update_product_acf_save_post');
    		update_on_product_save( $product_id, $product );
    	}
    }
    
    ##add_action('woocommerce_update_product', 'action_on_product_save', 20, 2);
    
    function update_on_product_save($product_id, $product ) {

    I get an error;

    Uncaught ArgumentCountError: Too few arguments to function woocommerce_update_product_acf_save_post(), 1 passed in /home/domain/public_html/wp-includes/class-wp-hook.php on line 307 and exactly 2 expected in /home/domain/public_html/wp-content/themes/hello-elementor-child/functions.php:50, referer: https://www.domain.com/wp-admin/post.php?post=7398&action=edit

    Any tips in resolving this?

    jordym

    (@jordym)

    Hi

    I’m having the same issue, I send an email to users who are subscribed to a products. But it e-mails the previous changes. My current code reads;

    add_action('woocommerce_update_product', 'action_on_product_save', 10, 2);
    
    function action_on_product_save($product_id, $product) {
        $updating_product_id = 'update_product_' . $product_id;
        if (false === ($updating_product = get_transient($updating_product_id))) {

    Should I replace my

    add_action('woocommerce_update_product', 'action_on_product_save', 10, 2);
    
    with 
    
    

    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 );
    }
    }`

    or am I reading this completly wrong?

    • This reply was modified 2 years ago by jordym. Reason: markup
Viewing 6 replies - 1 through 6 (of 6 total)