Tom Anbinder

Forum Replies Created

Viewing 15 posts - 46 through 60 (of 1,179 total)
  • Author
    Posts
  • in reply to: Use order meta field as trigger #121795
    Tom Anbinder
    Moderator
    Plugin Support

    Hi,

    We could check the meta each time order is saved – with the woocommerce_after_order_object_save action.

    Try adding this snippet to your site:

    add_action( 'woocommerce_after_order_object_save', function ( $order ) {
        if (
            function_exists( 'alg_wc_ce_send_email' ) &&
            'yes' === $order->get_meta( 'your_meta_key' ) // replace meta key
        ) {
            $custom_email_id = 1; // for the "Custom email #1"
            alg_wc_ce_send_email( $custom_email_id, $order->get_id() );
        }
    } );

    Please let me know what you think.

    in reply to: Currency Conversion Error #121335
    Tom Anbinder
    Moderator
    Plugin Support

    Hi Anju,

    Sorry for not getting back to you sooner.

    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: Using Data/Meta Saved from YITH Add-Ons #121332
    Tom Anbinder
    Moderator
    Plugin Support

    Hi David,

    Sorry for not getting back to you sooner.

    If you are still interested, please update the plugin to the latest v2.2.4. Now there is a new shortcode available: [order_item_meta]. The shortcode will output all items’ meta as a comma-separated list.

    To use the shortcode, you need to specify the key – in your case, it should be something like this:

    [order_item_meta key="date"]
    [order_item_meta key="time"]

    If you are not sure about the keys, try this (it will output all meta data, so you should be able to see the keys there):

    [order_item_meta debug="yes"]

    I hope this helps. And please let me know if you have any questions.

    in reply to: Feature Request #121222
    Tom Anbinder
    Moderator
    Plugin Support

    Hi,

    Have 3 brands with 15% discount on all products (Already have this active)

    First, add “Brands” to the “Taxonomies” option in the plugin’s “General” settings (in “WooCommerce > Settings > Global Shop Discount > General”).

    Then in your discount settings, you should be able to see “Brands > Include” and “Brands > Exclude” options (in “WooCommerce > Settings > Global Shop Discount > Discount Group #X”).

    Have the user role: Professional, with a 15% discount on all Products

    Add “Professional” in the “User roles > Include” option in the discount settings (in “WooCommerce > Settings > Global Shop Discount > Discount Group #X”).

    But don’t discount over the 15% already discounted by the first rule.

    Enable the “Stop on first matching discount group” checkbox in the plugin’s “General” settings (in “WooCommerce > Settings > Global Shop Discount > General”).

    I hope this helps, and please let me know if you have any questions.

    in reply to: Create automatic Promotions Category? #121147
    Tom Anbinder
    Moderator
    Plugin Support

    If anyone else is interested – the solution:

    Since the plugin v1.6.0, we have a new function that you can use to get all discounted product ids:

    alg_wc_gsd_get_product_ids( $product_query_args = array( 'limit' => -1 ), $incl_on_sale = true, $use_transient = false )

    I.e., in your snippet, replace this:

    $product_ids_on_sale = wc_get_product_ids_on_sale() ? wc_get_product_ids_on_sale() : array();

    with this:

    $product_ids_on_sale = alg_wc_gsd_get_product_ids() ? alg_wc_gsd_get_product_ids() : array();

    The alg_wc_gsd_get_product_ids() function has three optional parameters:

    • $product_query_args – sets which products to check. By default, it’s set to all products, i.e., array( 'limit' => -1 ). This parameter is passed directly to the WooCommerce wc_get_products() function, so you can use all the same parameters as listed in the documentation.
    • $incl_on_sale – if set to true, will return all on-sale products in your shop, including products that you have set on-sale manually, without using our plugin.
    • $use_transient – the function goes through all products in your shop, so it can be rather slow, especially if you have a lot of products. To speed things up, you can store results in a transient by setting the parameter to true. The transient expires after 24 hours.

    P.S. Just in case, we also have a shortcode to display all discounted products, e.g.:

    [alg_wc_gsd_products columns="4" use_transient="no"]
    in reply to: Filter everything plugin #121142
    Tom Anbinder
    Moderator
    Plugin Support

    Hi, Leonidas,

    Please update the plugin to the latest v1.9.0. Then run the “Save prices in DB for all products” tool in “WooCommerce > Settings > Global Shop Discount > Tools”. After that, you’ll probably want to disable the plugin’s discounts. Also, please keep in mind that as this tool will go through all products in your shop, it may take a while, especially if you have a lot of products.

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

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

    in reply to: Feature Request #121138
    Tom Anbinder
    Moderator
    Plugin Support

    Hi,

    Please update the plugin to the latest v1.9.0 – as requested, we’ve added the “User roles” options to the discount groups.

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

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

    in reply to: Searching for EAN not working in Astra #120985
    Tom Anbinder
    Moderator
    Plugin Support

    Hi, Michael,

    I’ve logged in to your site, and I think the problem is that your search is searching in blog posts, not products – you need to add post_type=product.

    You can do it by adding this to your search <form>:

    <input type="hidden" name="post_type" value="product">

    i.e., this doesn’t work:

    https://example.com/?s=2001234560382

    but this works:

    https://example.com/?s=2001234560382&post_type=product

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

    in reply to: Filter everything plugin #120677
    Tom Anbinder
    Moderator
    Plugin Support

    Hi, Leonidas,

    Ok, let me try…

    in reply to: status rules used for backorders #120635
    Tom Anbinder
    Moderator
    Plugin Support

    Hi, Lukasz,

    Sorry for not getting back to you sooner.

    I think this should save us from an infinite loop:

    add_filter( 'alg_wc_order_status_rules_do_apply_rule', function( $do_apply, $order, $rule_id, $args ) {
        if ( 1 == $rule_id && $do_apply ) {
            if ( 'backorder' === $args['last_record']['from'] ) {
                return false;
            }
        }
        return $do_apply;
    }, 10, 4 );

    As for your snippet for “… stock higher than 0…” – yes, it looks fine.

    Please let me know what you think.

    in reply to: Filter everything plugin #120631
    Tom Anbinder
    Moderator
    Plugin Support

    Hi, Leonidas,

    Sorry for not getting back to you sooner.

    Yes, sure, you can send it to [email protected]. However, to be honest, I don’t think it will help – I’m almost sure they are taking sales prices directly from DB, as I described earlier.

    in reply to: Pass the GTIN and Brand data in a schema #120625
    Tom Anbinder
    Moderator
    Plugin Support

    Hi,

    Sorry for not getting back to you sooner.

    Please try this:

    add_filter( 'woocommerce_structured_data_product', function ( $markup, $product ) {
    
        // Attributes
        $markup['material'] = $product->get_attribute( 'material' );
        $markup['color']    = $product->get_attribute( 'colour' );
    
        // Brand
        $markup['brand'] = current( wp_list_pluck( get_the_terms( $product->get_id(), 'wpfoof-brand' ), 'name' ) );
    
        return $markup;
    }, 10, 2 );
    in reply to: Get some data from Custom Product Option for Woo #120367
    Tom Anbinder
    Moderator
    Plugin Support

    Hi,

    Sorry for not getting back to you sooner.

    You can create your own shortcodes and then use them in the custom email’s “Email content” option. For example, this PHP snippet will create the [my_alg_wc_custom_emails_order_items_data] shortcode:

    add_shortcode( 'my_alg_wc_custom_emails_order_items_data', function ( $atts, $content = '' ) {
        $result = '';
        if ( function_exists( 'alg_wc_custom_emails' ) && ! empty( alg_wc_custom_emails()->core->shortcodes->order ) ) {
            $order = alg_wc_custom_emails()->core->shortcodes->order;
            foreach ( $order->get_items() as $item ) {
                foreach ( $item->get_data() as $key => $value ) {
                    if ( in_array( $key, array( 'radio-group-1662572212029', 'text-1662572721887', 'date-1662573909693' ) ) ) {
                        $result .= $key . ' - ' . $value . '<br>';
                    }
                }
            }
        }
        return $result;
    } );

    Please note that in your snippet, you are displaying cart item data, while in my snippet, we are displaying order item data – when sending an email, we don’t have cart data already. I’m not completely sure if the woocommerce_get_item_data filter returns the same result as the $item->get_data() function, but please give it a try.

    in reply to: Doubled ean #120320
    Tom Anbinder
    Moderator
    Plugin Support

    Hi Maciej,

    Could you please let me know if these problematic products have anything in common, e.g., all of them are variable products?

    in reply to: Filter everything plugin #120265
    Tom Anbinder
    Moderator
    Plugin Support

    Hi, Leonidas,

    I’ve just replied in the wp.org forum thread, but just in case, I’m posting the same here:

    I think that the “Filter Everything” plugin is taking sale prices directly from DB, i.e., from product meta, and our plugin is using filters to apply discounts, e.g., woocommerce_product_get_price.

    The only solution I can see is to create a tool that would go through all products in your shop, apply our plugin’s price filters, and save each product’s new sale price in DB. I believe this would solve the issue with the “Filter Everything” plugin, however, you would need to use our plugin a bit differently, e.g., each time you change the discount percentage, you would need to run the tool again, so it would go through all products and assign new prices (now the plugin is applying new prices immediately, without the need to run any tools).

    Please let me know what you think.

Viewing 15 posts - 46 through 60 (of 1,179 total)