Created
October 11, 2018 08:49
-
-
Save bainternet/17ebbd069763eb17dc7ef5de5faa0ad0 to your computer and use it in GitHub Desktop.
dd support for "Addify - Hide Product Price" to Elementor Price, and Add to Cart widgets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add support for "Addify - Hide Product Price" to | |
* Elementor Price, and Add to Cart widgets | |
*/ | |
add_filter( 'elementor/widget/render_content', function ( $widget_content, $widget ) { | |
global $product; | |
// Make sure its an add to cart or price widget | |
$widget_name = $widget->get_name(); | |
if ( ! in_array( $widget_name, [ 'wc-add-to-cart', 'woocommerce-product-price' ] ) ) { | |
return $widget_content; | |
} | |
// Make sure the 3rd party plugin is loaded | |
if ( ! function_exists( 'show_text_add_to_cart_link' ) ) { | |
return $widget_content; | |
} | |
return show_text_add_to_cart_link( $widget_content, $product ); | |
}, 10 ,2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment