Support » Plugin: Perfect Brands for WooCommerce » Coupon codes stopped working with latest update.

  • Resolved Karan



    Great plugin i must say.

    After the latest update we were getting error, “Sorry, this coupon is not applicable to selected products.” when a coupon code is applied. We disabled all plugins and after enabling one plugin at a time found that this happens when we enable this plugin.

    Can you please check and let us know on the fix please?

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • I can confirm. Created a new wordpress installation with only Woocommerce and PWB. Added two products without any images. Created two brands.

    When creating a discount coupon, selecting those specific brands only, makes the coupon work. If the Brand restrictions is empty, i.e Any brand, the coupon will return a “Sorry, this coupon is not applicable to selected products.”

    Now I imported all my products, coupons dont work on them. I create a new product, assign them a brand and a category, it works.
    Test System (although it does not really matter, since it occurs on older version of WC 3.2.6):

    [home_url] => test
    [site_url] => test
    [version] => 3.3.1
    [wp_version] => 4.9.4
    [wp_multisite] =>
    [wp_memory_limit] => 40M
    [wp_debug_mode] =>
    [wp_cron] => 1
    [language] => en_US
    [server_info] => Apache/2.4.23 (Win64) PHP/7.0.10
    [php_version] => 7.0.10
    [php_post_max_size] => 8M
    [php_max_execution_time] => 120
    [php_max_input_vars] => 2500
    [max_upload_size] => 2097152
    [default_timezone] => UTC
    [theme] => Array
    [name] => Storefront
    [version] => 2.2.7
    [parent_theme] =>

    [active_plugins] => Array
    [0] => perfect-woocommerce-brands/main.php
    [1] => woocommerce-eu-vat-compliance/eu-vat-compliance.php
    [2] => woocommerce-gateway-stripe/woocommerce-gateway-stripe.php
    [3] => woocommerce/woocommerce.php

    [pwb_options] => Array
    [version] => 1.6.2
    [wc_pwb_admin_tab_brand_single_position] => after_meta
    [old_wc_pwb_admin_tab_slug] => designers
    [wc_pwb_notice_plugin_review] =>
    [wc_pwb_admin_tab_slug] => designers
    [wc_pwb_admin_tab_brand_desc] => yes
    [wc_pwb_admin_tab_brand_single_product_tab] => yes
    [wc_pwb_admin_tab_brands_in_loop] => no
    [wc_pwb_admin_tab_brands_in_single] => brand_image
    [wc_pwb_admin_tab_brand_logo_size] => thumbnail


    Jos at supplied the fix!


    actually it’s related to a change I proposed to the WPB guys.

    For a quick fix, please find the file plugins/perfect-woocommerce-brands/classes/admin/class-pwb-coupon.php

    and replace

    if ( empty( $selected_brands ) ) return;


    if ( empty( $selected_brands ) ) return $valid;

    Thread Starter Karan


    @varange , tried the solution but seems it does not work. Are you sure this addresses the issue? I added the syntax but still it shows “Sorry, this coupon is not applicable to selected products.”

    Sorry, it worked for me.


    I can confirm that this issue still exists.

    Firstly, I got it working again by selecting every single Brand in “Brand Restrictions” within the Discount Code Exclusions section.
    But then found out that this only works on Simple Products. Any products that are Variable, such as ones with Colour Options in my store, I still get the error “Sorry, this coupon is not applicable to selected products.” when applying a discount code.

    Hi guys, the temporally fix provided by @varange and the coupon works fine now, hope this became a permanent fix and applied to the next update or otherwise the issue might come back again after the next update!

    Plugin Contributor titodevera


    The new version (PWB 1.6.3) solves this issue. Please update the plugin.


Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Coupon codes stopped working with latest update.’ is closed to new replies.