Tom Anbinder

Forum Replies Created

Viewing 15 posts - 1 through 15 (of 1,177 total)
  • Author
    Posts
  • in reply to: Multiple meta values #138719
    Tom Anbinder
    Moderator
    Plugin Support

    Hi, Lisa,

    Happy to hear it’s working 🙂 Let me know if you need anything else. And if you like the plugin, please consider leaving me a rating.

    in reply to: Multiple meta values #138644
    Tom Anbinder
    Moderator
    Plugin Support

    Hi, Lisa,

    Yes, I think this is doable – try enabling the “Meta > Multiple meta values” checkbox and setting the “Meta > Meta value” option to:

    ,0

    Please give it a try and let me know what you think.

    in reply to: Disable Coupon’s on Offered Price #137718
    Tom Anbinder
    Moderator
    Plugin Support

    Hi, Ashley,

    Sorry for not getting back to you sooner.

    Happy to hear it’s solved 🙂 Please let me know if you need anything else.

    P.S. Since the plugin v2.8.0, it’s possible to achieve what we need without a custom code. There is a new “Exclude price offers from coupons” checkbox option in “WooCommerce > Settings > Price Offers > General > Advanced Options” – it’s enabled by default.

    P.P.S. If you like the plugin, please consider leaving me a rating.

    in reply to: How to ? #136809
    Tom Anbinder
    Moderator
    Plugin Support

    P.P.S. Could you please check if “WordPress cron” is enabled on your site (in “WooCommerce > Status > System status”)? If it’s disabled, could you please enable it?

    You could also try switching from “Use WP cron” to “Use Action Scheduler” in “WooCommerce > Settings > Order Status Rules > Advanced > Periodical Processing Options”. However, as far as I understand, “Action Scheduler” uses WP cron, so I’m not sure if it’ll help.

    Also, did you try running the rules manually in “WooCommerce > Settings > Order Status Rules > Tools > Run all rules now”? What happens then? Are orders processed as expected?

    in reply to: Cart instead of package #136781
    Tom Anbinder
    Moderator
    Plugin Support

    Hi, Julian,

    Thank you for pointing it out – it looks like there was a bug in our plugin (when multiple shipping packages were used). Please update the plugin to the latest v1.8.0 – the issue should be gone now.

    Please give it a try and let me know what you think.

    in reply to: custom trigger addres change #136681
    Tom Anbinder
    Moderator
    Plugin Support

    Update: Since the latest plugin v2.9.3, we can now achieve what we need without custom triggers and code. There are two new “Extra” triggers: “Customer address saved” and “Customer address changed”. The first one is the same as the woocommerce_after_save_address_validation custom trigger I mentioned earlier. The second one is fired only if the address was actually changed (i.e., not just saved without any changes).

    Please give it a try and let me know what you think.

    in reply to: Disable Coupon’s on Offered Price #136605
    Tom Anbinder
    Moderator
    Plugin Support

    Hi, Ashley,

    Thank you for pointing it out. We will address this in the next plugin version. Meanwhile, if you are ok with adding a small PHP snippet to your site, I think this should solve our problem:

    add_filter( 'woocommerce_coupon_get_discount_amount', function ( $discount, $discounting_amount, $cart_item, $single, $coupon ) {
        return ( ! empty( $cart_item['alg_wc_price_offer_id'] ) ? 0 : $discount );
    }, 10, 5 );

    Please give it a try and let me know what you think.

    in reply to: How to ? #136600
    Tom Anbinder
    Moderator
    Plugin Support

    P.S. I’ve just noticed that you posted a screenshot earlier – your settings look ok there. If it’s not working – would it be possible to share access to your site, so I could log in and check what’s going on (my email is [email protected])?

    in reply to: How to ? #136598
    Tom Anbinder
    Moderator
    Plugin Support

    Hi, Eduard,

    I think what you need is to create two order status rules:

    Rule #1:

    • Status from: A
    • Status to: B
    • Time trigger: 2 days
    • Skip days: Saturday, Sunday

    Rule #2:

    • Status from: B
    • Status to: C
    • Time trigger: 2 days
    • Skip days: Saturday, Sunday

    Please give it a try and let me know what you think.

    in reply to: custom trigger addres change #136398
    Tom Anbinder
    Moderator
    Plugin Support

    Hi,

    I think what you need is the woocommerce_after_save_address_validation trigger:

    1. add it to the “Custom triggers” option (in “WooCommerce > Settings > Custom Emails > General”),
    2. select it in your custom email’s “Triggers” option (in “WooCommerce > Settings > Emails > Custom email #X”).

    P.S. If you want to use the [user_prop] shortcode in the custom email’s “Email content” option – add this PHP snippet to your site:

    add_filter( 'alg_wc_custom_emails_is_user_email', function ( $is_user_email, $current_filter ) {
        return ( 'woocommerce_after_save_address_validation_notification' === $current_filter ? true : $is_user_email );
    }, 10, 2 );

    And then you can use this in your email’s content:

    [user_prop key="nickname"]
    [user_prop key="description"]
    [user_prop key="first_name"]
    [user_prop key="last_name"]
    [user_prop key="user_login"]
    [user_prop key="user_nicename"]
    [user_prop key="user_email"]
    [user_prop key="user_url"]
    [user_prop key="display_name"]

    Please give it a try and let me know what you think.

    in reply to: Generate code at checkout #136303
    Tom Anbinder
    Moderator
    Plugin Support

    Hi, Shawn,

    This PHP snippet will automatically generate a random 4-digit code (when order is processed on checkout) and save it in the door_code order meta:

    add_action( 'woocommerce_checkout_order_processed', function ( $order_id, $posted_data, $order ) {
    
        if ( '' !== $order->get_meta( 'door_code' ) ) {
            return; // make sure we don't overwrite order's existing door code
        }
    
        $door_code = sprintf( '%04d', rand( 0, 9999 ) );
    
        $order->update_meta_data( 'door_code', $door_code );
        $order->save();
    
    }, 9, 3 );

    Then we can add it to the custom email with the [order_meta] shortcode:

    [order_meta key="door_code" before="Door code: "]

    The shortcode should be added to the “Email content” option (in “WooCommerce > Settings > Emails > Custom email #X”).

    P.S. When testing, I’ve set the “Triggers” option to the “New order (Any status)”.

    Please give it a try and let me know what you think.

    Tom Anbinder
    Moderator
    Plugin Support

    Hi, Liviu,

    Please update the plugin to the latest v2.9.1 and add this snippet to your site:

    add_action( 'alg_wc_custom_emails_email_sent', function ( $email ) {
    
        global $wpdb;
    
        $option_name = "woocommerce_{$email->id}_settings";
    
        // Start MySQL transaction
        $wpdb->query( 'START TRANSACTION' );
    
        // Get current settings
        $row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM {$wpdb->options} WHERE option_name = %s LIMIT 1", $option_name ) );
    
        // Exclude recipients
        $settings = ( isset( $row->option_value ) && '' !== $row->option_value ? unserialize( $row->option_value ) : array() );
        $settings['exclude_recipients'] = $email->get_recipient() . ',' . ( $settings['exclude_recipients'] ?? '' );
        $settings = serialize( $settings );
    
        // Update (or Insert)
        if ( 0 === ( $result = $wpdb->update( $wpdb->options, array( 'option_value' => $settings, 'autoload' => 'yes' ), array( 'option_name' => $option_name ) ) ) ) {
            $result = $wpdb->insert( $wpdb->options, array( 'option_value' => $settings, 'autoload' => 'yes', 'option_name' => $option_name ) );
        }
    
        // Commit (or Rollback) MySQL transaction
        $wpdb->query( ( $result ? 'COMMIT' : 'ROLLBACK' ) );
    
    } );

    This snippet will automatically append the current recipient to the “Exclude recipients” option (in “WooCommerce > Settings > Emails > Custom email #X > Advanced Options”). This way, you can manually edit it if needed. However, the option may become too long if you send a lot of emails.

    P.S. Generally, the snippet does this:

    add_action( 'alg_wc_custom_emails_email_sent', function ( $email ) {
        $email->update_option(
            'exclude_recipients',
            $email->get_recipient() . ',' . $email->get_option( 'exclude_recipients', '' )
        );
    } );

    However, I think this shorter version has a problem – it may skip adding a recipient if two different custom emails are sent at (almost) the same time. To solve this, in the first snippet we are using MySQL transactions and executing DB queries directly.

    Please give it a try and let me know what you think.

    in reply to: Is the plugin compatible with Woocommerce Subscriptions? #135437
    Tom Anbinder
    Moderator
    Plugin Support

    Hi, Tuomas,

    I’ve just tested it on my server – it seems to be working fine here, the renewal order is automatically updated from “Pending payment” to “Completed”. Could you please try running the “Run all rules now” tool (in “WooCommerce > Settings > Order Status Rules > Tools”) and let me know if the renewals are still “pending”?

    in reply to: Test emails not sending automatically #135103
    Tom Anbinder
    Moderator
    Plugin Support

    Hi, Jesse,

    Sorry for not getting back to you sooner.

    Could you please enable the “Debug” checkbox in “WooCommerce > Settings > Custom Emails > General > Advanced Options”, trigger automatic email, and then check today’s log in “WooCommerce > Status > Logs” (the log will start with custom-emails-for-woocommerce-...). What does it say?

    P.S. If this won’t help – would it be possible to share access to your site, so I could log in and check what’s going on (my email is [email protected])?

    in reply to: custom trigger #133973
    Tom Anbinder
    Moderator
    Plugin Support

    Update: Since the plugin v2.8.0, it’s now possible to achieve the same without the snippet – with the new “Require order status” (and “Exclude order status”) option (in “WooCommerce > Settings > Emails > Custom email #X > Order Options”).

Viewing 15 posts - 1 through 15 (of 1,177 total)