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 characters
if ( ! function_exists( 'yith_pos_customization_show_print_items_link' ) ) { | |
add_action( 'wp_enqueue_scripts', 'yith_pos_customization_show_print_items_link', 99 ); | |
function yith_pos_customization_show_print_items_link() { | |
$js = "wp.hooks.addFilter('yith_pos_header_links', 'yith-pos/customization', (links) => { | |
let newLinks = []; | |
links.forEach( link => { | |
if( link.className === 'register-logout-link' ){ | |
link.show = true; |
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 characters
<?php | |
add_action( 'woocommerce_applied_coupon', 'change_subscription_next_payment_due_date' ); | |
add_action( 'woocommerce_removed_coupon', 'change_subscription_next_payment_due_date_on_remove_coupon' ); | |
function change_subscription_next_payment_due_date( $coupon_code ) { | |
if ( 'bundle' === strtolower( $coupon_code ) ) { | |
change_next_billing_date( 90 ); | |
} | |
} |
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 characters
<?php | |
if( defined('YITH_WCAS_VERSION')){ | |
remove_action( 'storefront_header', 'storefront_product_search', 40 ); | |
add_action( 'storefront_header', 'ywcas_product_search', 40 ); | |
function ywcas_product_search(){ | |
?> | |
<div class="site-search"> | |
<?php echo do_shortcode('[yith_woocommerce_ajax_search]'); ?> |
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 characters
<?php if( function_exists('YWSBS_Subscription_Order')){ | |
add_filter('ywsbs_renew_order_status', 'ywsbs_put_woo_stripe_renew_in_pending', 10, 2); | |
function ywsbs_put_woo_stripe_renew_in_pending( $status, $subscription ){ | |
if( $subscription && 'stripe'===$subscription->payment_method){ | |
$status = 'pending'; | |
} | |
return $status; | |
} |
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 characters
<?php | |
if ( defined( 'YITH_WCAS_PREMIUM' ) ) { | |
add_action( 'ywcas_before_do_the_request', 'yith_wcas_query_fix' ); | |
function yith_wcas_query_fix() { | |
global $yith_wcas, $wp_the_query; | |
remove_filter( 'posts_where', array( $yith_wcas, 'extend_search_where' ) ); | |
remove_filter( 'posts_join', array( $yith_wcas, 'extend_search_join' ) ); |
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 characters
phpcs --standard=WordPress templates/request-quote-view.php | |
#hide warning | |
phpcs --standard=WordPress -n templates/request-quote-view.php | |
#automation | |
phpcs --standard=WordPress --report-diff=changes.diff view-quote.php | |
patch -p0 -ui changes.diff | |
//only escape |
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 characters
<?php | |
add_filter( 'woocommerce_rest_product_object_query', 'yith_pos_extend_post_per_pages', 5, 2 ); | |
function yith_pos_extend_post_per_pages( $args, $request ){ | |
if ( isset( $_GET[ 'queryName' ] ) && 'yith_pos_search' === $_GET[ 'queryName' ] ) { | |
$args[ 'posts_per_page' ] = 20; | |
} | |
return $args; |
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 characters
<?php | |
add_filter( 'woocommerce_rest_prepare_product_object', 'yith_pos_custom_product_response', 20, 3 ); | |
function yith_pos_custom_product_response( $response, $object, $request ) { | |
$param = $request->get_param( 'queryName' ); | |
if ( $param == 'yith_pos_search' ) { | |
$result = $response->data; | |
$result['name'] .= empty($result['sku']) ? '' : ' - ' . $result['sku']; | |
$response->data = $result; |
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 characters
<?php | |
add_action( 'init', 'yith_pos_add_meta_to_products' ); | |
function yith_pos_add_meta_to_products() { | |
$option = get_option( 'yith_pos_stock_product_enabled', 'no' ); | |
if ( $option === 'no' ) { | |
$products = wc_get_products( array( 'limit' => - 1 ) ); | |
if ( $products ) { |
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 characters
<?php | |
if ( defined( 'YITH_POS_VERSION' ) && ! function_exists( 'yith_pos_add_user_role_to_pos_class' ) ) { | |
add_filter( 'yith_pos_body_classes', 'yith_pos_add_user_role_to_pos_class' ); | |
function yith_pos_add_user_role_to_pos_class( $body_class ) { | |
if ( is_user_logged_in() ) { | |
$user = wp_get_current_user(); | |
$body_class = array_merge( $body_class, (array) $user->roles ); | |
} |