Repository Forums Support WooCommerce Extended Coupon Features PRO Get coupon description using WC_Coupon::get_description()

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2245
    Jonathan Moore
    Participant

    = 2.5.4 =
    * TWEAK: Get coupon description using WC_Coupon::get_description() to respect applicable filters (for example used by Polylang)

    I was checking this and I found that to get the results I expected I need to change WJECF_Wrap.php get_description() last line
    from:
    $post->post_excerpt;
    to:

            return apply_filters( 'woocommerce_coupon_get_description', 
                $post->post_excerpt, $post );

    could this be included in a future patch…

    #2256
    Soft79
    Keymaster

    Is this in combination with WooCommerce 2.6 by any chance?

    #2297
    Jonathan Moore
    Participant

    that was with WooCommerce 3.2.1
    The same applies to the latest Coupons 2.6.0.2

    Coupon description comes from the excerpt field and since you are using $post->post_excerpt; rather than woocommerce api the woocommerce filters won’t be called

    #2299
    Soft79
    Keymaster

    I see what’s happening:

    The false && must be removed from the first line of the function:

    if ( false && $this->use_wc27 && is_callable( array( $this->object, 'get_description' ) ) )

    Will remove it in the next version.

    $post->post_excerpt must only be called as a fallback for WC < 3.0

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