Categories
CMS Mastering Development Wordpress

Combine one action and one filter

I want to show an error message in Woocommerce checkout page, and remove the order button. I can use one action and one filter: add_action( ‘woocommerce_before_checkout_form’, ‘add_checkout_error’, 9 ); function add_checkout_error() { wc_print_notice( __( ‘An error message.’, ‘woocommerce’ ), ‘error’ ); } add_filter(‘woocommerce_order_button_html’, ‘remove_order_button_html’ ); function remove_order_button_html( $button ) { $button = ”; return $button; […]

Categories
CMS Mastering Development Wordpress

Remove item in Checkout

I am using this code for remove items in Checkout add_filter(‘woocommerce_cart_item_name’, ‘custom_filter_wc_cart_item_remove_link’, 10, 3); function custom_filter_wc_cart_item_remove_link($product_name, $cart_item, $cart_item_key) { if (is_checkout()) { $product_name .= apply_filters(‘woocommerce_cart_item_remove_link’, sprintf( ‘<a href="%s" rel="nofollow" class="remove" style="float:left;">&times;</a>’, esc_url(WC_Cart::get_remove_url($cart_item_key)), __(‘Remove this item’, ‘woocommerce’), esc_attr($cart_item[‘product_id’]), esc_attr($cart_item[‘data’]->get_sku()) ), $cart_item_key); return $product_name; } } But it has an error because this line is old code […]

Categories
CMS Mastering Development Wordpress

Woocommerce Filter orders by shipping method

My current code shows the proper options in the drop down but for some reason the filter is still not working correct. It still shows all the orders when using this filter. Running the query against the database directly looks to be giving me the correct results. Our shipping options do have spaces in their […]

Categories
CMS Mastering Development Wordpress

Display Default Content If Custom Field Is Empty

I am using Woocommerce multi vendor. I have a custom field I would like it to display default content "Currently Shipping World Wide" if the vendor has not added any content to the field. The code works well if the custom field has content. But it is not working if the custom field is empty. […]

Categories
CMS Mastering Development Wordpress

WooCommerce with ACF: custom fields per product variation

I’m a little stuck here. So I have variable products and I need to show the output of a custom field in a custom tab. So I created a new field in ACF, called ‘test’. I’ve got this to work for the product itself, but the content does not change when I select another variable. […]

Categories
Mastering Development

Woocommerce checkout duplicates shipping area

I have been trying to create my own woocommerce theme and right now I am configuring the checkout form. On the cart page I modified the cart-shipping.php to make it collapsible and show the estimated amount based on their location. And when they click "shipping options" it opens the form like this – Now when […]

Categories
CMS Mastering Development Wordpress

Woocommerce custom webhook -> action woocommerce_before_calculate_totals

I want to create a custom webhook in woocommerce. I have done something like this before, but can’t remember the syntax and am having trouble finding it in the docs. I have a custom plugin with the following code function add_new_webhook_topics( $topics ) { // New topic array to add to the list, must match […]

Categories
Mastering Development

Editable Text Price Filter Span

i have here a woocommerce product price filter template. How can i make the price text editable and make the slider still functional? <?php do_action( ‘woocommerce_widget_price_filter_start’, $args ); ?> <form method="get" action="<?php echo esc_url( $form_action ); ?>"> <div class="price_slider_wrapper"> <div class="price_slider" style="display:none;"></div> <div class="price_slider_amount" data-step="<?php echo esc_attr( $step ); ?>"> <input type="text" id="min_price" name="min_price" value="<?php […]

Categories
CMS Mastering Development Wordpress

Woocommerce Dynamic Pricing – show amount saved in cart

I would like you to help me with this problem, I am working with Woocommerce Dynamic Pricing and everything is going well, the problem is that the client wants to show how much a client has saved below the sub-total, all good until there, the problem is The discount given by dynamic pricing does not […]

Categories
CMS Mastering Development Wordpress

New field on checkout is shown but it’s not saved on the order details

I am having a problem adding a custom field on the checkout of WooCommerce, I am using this code: add_filter(‘woocommerce_checkout_fields’,’custom_override_checkout_fields’); function custom_override_checkout_fields($fields) { $fields[‘billing’][‘billing_colonia’] = array( ‘label’ => __(‘Colonia’, ‘woocommerce’), ‘placeholder’ => _x(”, ‘placeholder’, ‘woocommerce’), ‘required’ => true, ‘class’ => array(‘form-row-wide’), ‘clear’ => true ); $fields[‘shipping’][‘shipping_colonia’] = array( ‘label’ => __(‘Colonia’, ‘woocommerce’), ‘placeholder’ => _x(”, […]