SHOW:
|
|
- or go back to the newest paste.
1 | $products = get_field('product'); | |
2 | ||
3 | - | if (get_field('product')) { |
3 | + | if (get_field('product')) { |
4 | foreach ($products as $product) { | |
5 | $current_user = wp_get_current_user(); | |
6 | - | |
6 | + | |
7 | if ( is_user_logged_in() && (wc_customer_bought_product( $current_user->user_email, $current_user->ID, $product->ID ))) { | |
8 | - | $current_user = wp_get_current_user(); |
8 | + | |
9 | } else { | |
10 | - | if ( is_user_logged_in() && (wc_customer_bought_product( $current_user->user_email, $current_user->ID, $product->ID ))) { |
10 | + | echo '<div>' . do_shortcode('[add_to_cart id="' . $product->ID . '" style=""]') . '</div>'; |
11 | - | |
11 | + | |
12 | } | |
13 | - | |
13 | + |