Repository › Forums › Support › WooCommerce Extended Coupon Features PRO › Get coupon description using WC_Coupon::get_description()
- This topic has 3 replies, 2 voices, and was last updated 8 years, 9 months ago by Soft79.
- AuthorPosts
- November 30, 2017 at 3:52 pm #2245Jonathan MooreParticipant
= 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…
December 1, 2017 at 4:56 pm #2256Soft79KeymasterIs this in combination with WooCommerce 2.6 by any chance?
December 5, 2017 at 5:56 am #2297Jonathan MooreParticipantthat was with WooCommerce 3.2.1
The same applies to the latest Coupons 2.6.0.2Coupon 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
December 5, 2017 at 7:56 am #2299Soft79KeymasterI 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
- AuthorPosts
- You must be logged in to reply to this topic.