Last active
October 3, 2024 13:40
-
-
Save Crocoblock/bcf96e00d54d84f38865d175d01fbe67 to your computer and use it in GitHub Desktop.
Revisions
-
Crocoblock revised this gist
Mar 6, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -23,7 +23,7 @@ public function macros_callback( $args = array() ) { $user_id = get_current_user_id(); if ( ! $user_id || ! function_exists( 'WC' ) ) { return; } -
Crocoblock revised this gist
Feb 20, 2023 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,7 @@ add_action( 'jet-engine/register-macros', function() { /** * Return purchased products. */ class Purchased_Products_Macro extends \Jet_Engine_Base_Macros { @@ -29,7 +29,7 @@ public function macros_callback( $args = array() ) { $args = array( 'customer_id' => $user_id, 'limit' => -1, 'status' => array( 'completed', ), -
Crocoblock revised this gist
Feb 20, 2023 . 1 changed file with 40 additions and 39 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,57 +1,58 @@ <?php add_action( 'jet-engine/register-macros', function() { /** * Return purchased and payed products. */ class Purchased_Products_Macro extends \Jet_Engine_Base_Macros { public function macros_tag() { return 'purchased_products'; } public function macros_name() { return esc_html__( 'Purchased products', 'jet-engine' ); } public function macros_args() { return array(); } public function macros_callback( $args = array() ) { $user_id = get_current_user_id(); if ( ! user_id || ! function_exists( 'WC' ) ) { return; } $args = array( 'customer_id' => $user_id, 'limit' => -1, 'status' => array( 'completed', ), ); $orders = wc_get_orders( $args ); $products = array(); foreach ( $orders as $order ) { $items = $order->get_items(); foreach ( $items as $item ) { $products[] = $item->get_data()['product_id']; } } return implode( ',', $products ); } } new Purchased_Products_Macro(); } ); -
Crocoblock revised this gist
Aug 1, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -27,7 +27,7 @@ public function macros_callback( $args = array() ) { } $args = array( 'customer_id' => $user_id, 'limit' => -1, 'status' => array( 'completed', -
Crocoblock revised this gist
Jul 19, 2022 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -28,6 +28,7 @@ public function macros_callback( $args = array() ) { $args = array( 'customer_id' => get_current_user_id(), 'limit' => -1, 'status' => array( 'completed', ), -
Crocoblock revised this gist
Jul 18, 2022 . 1 changed file with 3 additions and 5 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -22,7 +22,7 @@ public function macros_callback( $args = array() ) { $user_id = get_current_user_id(); if ( ! user_id || ! function_exists( 'WC' ) ) { return; } @@ -50,9 +50,7 @@ public function macros_callback( $args = array() ) { return implode( ',', $products ); } } new Purchased_Products_Macro(); } ); -
Crocoblock revised this gist
Jul 18, 2022 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,4 @@ <?php add_action( 'jet-engine/register-macros', function() { /** -
Crocoblock revised this gist
Jul 18, 2022 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -19,6 +19,12 @@ public function macros_args() { public function macros_callback( $args = array() ) { $user_id = get_current_user_id(); if ( ! user_id ) { return; } $args = array( 'customer_id' => get_current_user_id(), 'status' => array( -
Crocoblock revised this gist
Jul 18, 2022 . 1 changed file with 27 additions and 27 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -18,34 +18,34 @@ public function macros_args() { } public function macros_callback( $args = array() ) { $args = array( 'customer_id' => get_current_user_id(), 'status' => array( 'completed', ), ); $orders = wc_get_orders( $args ); $products = array(); foreach ( $orders as $order ) { $items = $order->get_items(); foreach ( $items as $item ) { $products[] = $item->get_data()['product_id']; } } return implode( ',', $products ); } } if ( function_exists( 'WC' ) ) { new Purchased_Products_Macro(); } } ); -
Crocoblock created this gist
Jul 18, 2022 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,51 @@ add_action( 'jet-engine/register-macros', function() { /** * Return purchased and payed products. */ class Purchased_Products_Macro extends \Jet_Engine_Base_Macros { public function macros_tag() { return 'purchased_products'; } public function macros_name() { return esc_html__( 'Purchased products', 'jet-engine' ); } public function macros_args() { return array(); } public function macros_callback( $args = array() ) { $args = array( 'customer_id' => get_current_user_id(), 'status' => array( 'completed', ), ); $orders = wc_get_orders( $args ); $products = array(); foreach ( $orders as $order ) { $items = $order->get_items(); foreach ( $items as $item ) { $products[] = $item->get_data()['product_id']; } } return implode( ',', $products ); } } if ( function_exists( 'WC' ) ) { new Purchased_Products_Macro(); } } );