Repository Forums Support WooCommerce Extended Coupon Features PRO Restriction for a product attribute

Topic Resolution: Resolved
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #1657

    Is there a way to apply a restriction based on a product attribute the way restriction can be applied for a product category?



    back with this request. I think I managed to make this working, but I had to modify the plugin core.

    Please give feedback and if you know a better solution (using hooks or something) to achieve this I would like to know.


    I have a product attribute called with the slug tip-produs (product type in english) for which I have the following terms: full-size, trial-size (these are the slugs)

    I have these applied to certain product variations. For example: On a product one variation has the full-size, the other variation has the trial-size. Similar like you would have a shirt with red and blue color.

    Modifications I did in core:

    includes/pro/WJECF_Pro_Product_Filter.php on the get_all_custom_fields function

    I modified this: WHERE p.post_type = 'product' to WHERE p.post_type = 'product' OR p.post_type = 'product_variation'

    for the product_matches_custom_field function (same file) instead of using $metavalue = WJECF_Wrap( $product )->get_meta( $cf['key'], true ); I used $metavalue = get_post_meta( WJECF_Wrap( $product )->get_id(), $cf['key'], true);

    Coupon setup:

    – percent discount: 10
    – minimum value: 30
    – custom fields: attribute_pa_tip-produs (name) full-size (value)


    I will look at this soon…


    Could you please download development version 2.5.4 from your account page and see if that version resolves your issue?

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.