Create automatic Promotions Category?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #110817
    BLC
    Participant

    Hi! I created this thread a month ago: https://wordpress.org/support/topic/show-discounted-products-on-the-discounted-products-page/
    Would it be possible to have this implemented? We need it before moving on and buying the pro version so that we can apply multiple discounts.
    Thanks!

    #111292
    Moshtafizur
    Moderator
    Plugin Support

    Hi there,

    sorry for the late reply.

    I have passed your request on to the relevant team. They will get back to you as soon as they can.

    Kind regards,
    Moshtafizur

    #111294
    BLC
    Participant

    Hi! Alright, I’ll be pestering you here for updates ūüôā Thanks!

    #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"]
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.