PHP Drukuj wszystkie produkty WooCommerce
/**
* @snippet Get All WooCommerce Product IDs
* @how-to Get CustomizeWoo.com FREE
* @author Rodolfo Melogli
* @compatible WooCommerce 5
* @donate $9 https://businessbloomer.com/bloomer-armada/
*/
add_action( 'woocommerce_before_cart', 'bbloomer_echo_product_ids' );
function bbloomer_echo_product_ids() {
$all_ids = get_posts( array(
'post_type' => 'product',
'numberposts' => -1,
'post_status' => 'publish',
'fields' => 'ids',
) );
foreach ( $all_ids as $id ) {
echo $id;
}
}
Button