This file contains 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
function theme_is_header_footer_builder_active( $is_header_footer_builder_active ) { | |
return false; | |
} | |
add_filter( 'astra_is_header_footer_builder_active', 'theme_is_header_footer_builder_active', 10, 1 ); |
This file contains 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
function display_user_subscription_product( $product_ids ) { | |
// Only on Product Category archives pages | |
if( is_admin() || ! is_product_category( 'membership' ) || ! is_user_logged_in() ) return $product_ids; | |
$subscription_product_id = get_user_meta( get_current_user_id(), 'current_user_subscription_product_id', true ); | |
if ( is_numeric( $subscription_product_id ) && ! empty( $subscription_product_id ) ) { | |
$product_ids[] = $subscription_product_id; | |
} | |
return $product_ids; |
This file contains 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
// Custom function for product creation (For Woocommerce 3+ only) | |
function create_product( $args ){ | |
if( ! function_exists('wc_get_product_object_type') && ! function_exists('wc_prepare_product_attributes') ) | |
return false; | |
// Get an empty instance of the product object (defining it's type) | |
$product = wc_get_product_object_type( $args['type'] ); | |
if( ! $product ) | |
return false; |
This file contains 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
/** | |
* Add the barcode URL in REST API responses. | |
* @since 1.3.24 | |
* @param object $response WP_REST_Response | |
* @param object $object Order Object | |
* @param object $request The request made to WC-API | |
* @return object $response | |
*/ | |
function add_barcode_url_in_api_response ( $response, $object, $request ) { | |
if ( is_a( $response, 'WP_REST_Response' ) && is_a( $object, 'WC_Order' ) ) { |
This file contains 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
function request_token() { | |
$encoded_auth = base64_encode( $this->client_id . ":" . $this->client_secret ); | |
$args = array( | |
'method' => 'POST', | |
'httpversion' => '1.1', | |
'headers' => array( | |
'Authorization' => 'Basic '. $encoded_auth, | |
'Content-Type' => 'application/x-www-form-urlencoded;charset=UTF-8', | |
), |
This file contains 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
add_filter( 'woocommerce_shipping_calculator_enable_postcode', '__return_false' ); |
This file contains 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
add_action( 'wp_footer', function(){ | |
$cron_jobs = get_option( 'cron' ); | |
var_dump($cron_jobs); | |
}); |
This file contains 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
add_action( 'save_post', 'product_created_or_updated', 10, 3); | |
function product_created_or_updated($post_id, $post, $update){ | |
if ($post->post_status != 'publish' || $post->post_type != 'product') { | |
return; | |
} | |
if ( !$product = wc_get_product( $post_id ) ) { | |
return; | |
} |
This file contains 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
add_action( 'woocommerce_new_order', 'order_is_created', 10, 1 ); | |
function order_is_created( $order_id ){ | |
$order = wc_get_order( $order_id ); | |
if( !$order ){ | |
return; | |
} | |
} |
This file contains 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
function custom_split_shipping_packages_shipping_class( $packages ) { | |
// Reset all packages | |
$packages = array(); | |
$split_package_qty = array(); | |
foreach ( WC()->cart->get_cart() as $item_key => $item ) { | |
for( $i = 0; $i < $item['quantity']; $i++ ){ |