Last active
June 29, 2022 11:21
-
-
Save UraraReika/0944fd7706619f2876385422ec4d23f4 to your computer and use it in GitHub Desktop.
Extend macros list of JetEngine listing.
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_filter( 'jet-engine/listings/macros-list', '__your_theme_prefix_get_products_on_sale' ); | |
// Add macros to list. | |
function __your_theme_prefix_get_products_on_sale( $macros_list ) { | |
$macros_list['on_sale_products_ids'] = [ | |
'label' => esc_html__( 'On Sale Products IDs', 'jet-engine' ), | |
'cb' => 'get_on_sale_products_ids', | |
]; | |
return $macros_list; | |
} | |
// Macros callback handle. | |
function get_on_sale_products_ids() { | |
return array_merge( array( 0 ), wc_get_product_ids_on_sale() ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment