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
<?php | |
/* this function remove free shipping if the discount of dynamic is applied in the cart */ | |
if( class_exists('YITH_WC_Dynamic_Discounts') ){ | |
add_filter( 'woocommerce_shipping_packages', 'show_packages' ); | |
function show_packages($packages){ | |
$label = YITH_WC_Dynamic_Discounts()->label_coupon; | |
$newpack = $packages; | |
foreach ( $packages as $key_package => $package ) { | |
if( isset( $package['applied_coupons'] ) && in_array( $label, $package['applied_coupons'] ) ){ | |
if ( sizeof( $package['rates'] ) > 0 ) { |
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
To show the search form, | |
you can use | |
[yith_woocommerce_ajax_search] | |
or php code: | |
<?php echo do_shortcode('[yith_woocommerce_ajax_search]'); ?> | |
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
<?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 ); | |
} |
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
<?php | |
add_action( 'admin_enqueue_scripts', 'ywpi_pdf_template_licence_key', 99 ); | |
if ( ! function_exists( 'ywpi_pdf_template_licence_key' ) ) { | |
function ywpi_pdf_template_licence_key() { | |
$js = "wp.hooks.addFilter('ywpi_pdf_template_demo', 'yith-woocommerce-pdf-invoice/customization', (key) => { | |
return 'ywpi_live_demo'; | |
} );"; | |
wp_add_inline_script( 'ywpi-pdf-template-builder-script', $js, 'after' ); |
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
<?php | |
add_action( 'admin_enqueue_scripts', 'ywpi_pdf_template_licence_key', 99 ); | |
if ( ! function_exists( 'ywpi_pdf_template_licence_key' ) ) { | |
function ywpi_pdf_template_licence_key() { | |
$js = "wp.hooks.addFilter('ywpi_pdf_template_demo', 'yith-woocommerce-pdf-invoice/customization', (key) => { | |
return 'ywpi_live_demo'; | |
} );"; | |
wp_add_inline_script( 'ywpi-pdf-template-builder-script', $js, 'after' ); |
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_cart_loaded_from_session', 'wpm_cart_order_items_by_price' ); | |
function wpm_cart_order_items_by_price( $cart ) { | |
//if the cart is empty do nothing | |
if ( empty( $cart->cart_contents ) ) { | |
return; | |
} | |
//this is an array to collect cart items |
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
import apiFetch from '@wordpress/api-fetch'; | |
import {addQueryArgs} from '@wordpress/url'; | |
import {getCurrentPost} = wp.data.select('core/editor'); | |
const api_path = '/wp/v2/pdf_template/'; //this is the slug of rest_endpoint set inside the register_post_type | |
function TemplateList() { | |
function handleOnClick(template) { |
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
wp.domReady(() => { | |
find blocks styles | |
wp.blocks.getBlockTypes().forEach((block) => { | |
console.log(block); | |
if (_.isArray(block['styles'])) { | |
console.log(block.name, _.pluck(block['styles'], 'name')); | |
} | |
}); |
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
<?php | |
if ( function_exists( 'YITH_WC_Subscription_Frontend' ) ) { | |
add_filter( 'woocommerce_customer_get_downloadable_products', 'woocommerce_order_get_downloadable_items_ywsbs_helper' ); | |
function woocommerce_order_get_downloadable_items_ywsbs_helper( $downloads ) { | |
if ( ! is_account_page() ) { | |
return $downloads; | |
} |
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
<?php | |
if( defined('YITH_YWRAQ_PREMIUM') ){ | |
add_action('wp_footer','raq_script',9999); | |
function raq_script() { ?> | |
<script> | |
jQuery(document).ready(function($) { |
NewerOlder