Placeholder

HP 871A Magenta Latex inkcartridge 3000 ml

Login to see prices
Artikelnummer: G0Y80C Categorie:

Product beschrijving

Specificaties

merk-product

inktkleur

geschikt-voor-type-printer

verpakking

Cartridge, Cartridge 3000 ml

Inspirerende applicaties

Prijsoverzicht

Downloads

/** * @snippet Display All Products Purchased by User via Shortcode - WooCommerce * @how-to Watch tutorial @ https://businessbloomer.com/?p=19055 * @sourcecode https://businessbloomer.com/?p=22004 * @author Rodolfo Melogli * @compatible Woo 3.5.7 * @donate $9 https://businessbloomer.com/bloomer-armada/ */ add_shortcode( 'my_products', 'bbloomer_user_products_bought' ); function bbloomer_user_products_bought() { global $product, $woocommerce, $woocommerce_loop; $columns = 3; // GET USER $current_user = wp_get_current_user(); // GET USER ORDERS (COMPLETED + PROCESSING) $customer_orders = get_posts( array( 'numberposts' => -1, 'meta_key' => '_customer_user', 'meta_value' => $current_user->ID, 'post_type' => wc_get_order_types(), 'post_status' => array_keys( wc_get_is_paid_statuses() ), ) ); // LOOP THROUGH ORDERS AND GET PRODUCT IDS if ( ! $customer_orders ) return; $product_ids = array(); foreach ( $customer_orders as $customer_order ) { $order = wc_get_order( $customer_order->ID ); $items = $order->get_items(); foreach ( $items as $item ) { $product_id = $item->get_product_id(); $product_ids[] = $product_id; } } $product_ids = array_unique( $product_ids ); // QUERY PRODUCTS $args = array( 'post_type' => 'product', 'post__in' => $product_ids, ); $loop = new WP_Query( $args ); // GENERATE WC LOOP ob_start(); woocommerce_product_loop_start(); while ( $loop->have_posts() ) : $loop->the_post(); wc_get_template_part( 'content', 'product' ); endwhile; woocommerce_product_loop_end(); woocommerce_reset_loop(); wp_reset_postdata(); // RETURN CONTENT return '
' . ob_get_clean() . '
'; }