php – WooCommerce: how to add a custom type product (composite compound) to the cart

I am creating a mobile application and I need to add products with ajax requests.

My client uses a type of custom product called yith-composite that converts the products to parents and children (component)

Like a car (father) and wheels (component)

My problem that the button add to cart (ajax) and wx-ajax = add_to_cart does not work with this type of product,

Adding to cart works correctly only if I deactivated the ajax and let it submit the form and then update.

When the application form data were viewed, they were as follows:

ywcp_selection(153CE4EE-C1A0-6D39-9AD5-58B51C5AB306): -1
attribute_pa_sphere: 7-50
ywcp_variation_id(153CE4EE-C1A0-6D39-9AD5-58B51C5AB306): 124138
ywcp_quantity(153CE4EE-C1A0-6D39-9AD5-58B51C5AB306): 1
ywcp_selected_product_value(153CE4EE-C1A0-6D39-9AD5-58B51C5AB306): 102523
ywcp_selection(471BAD03-9C3B-B44E-8584-348A5F33F8A6): -1
attribute_pa_sphere: 7-00
ywcp_variation_id(471BAD03-9C3B-B44E-8584-348A5F33F8A6): 110356
ywcp_quantity(471BAD03-9C3B-B44E-8584-348A5F33F8A6): 1
ywcp_selected_product_value(471BAD03-9C3B-B44E-8584-348A5F33F8A6): 102552
quantity: 1
add-to-cart: 102491

So, my question about how to modify the wc-ajax = add_to_cart default to accept that kind of new data. and adding the product correctly to the cart?

WooCommerce – Total product goal to add taxes

I found a problem in WooCommerce that I am desperately trying to solve.

When adding an order (or an order is placed through the store), on the order edit / view screen, in the Product Meta section, you have five columns. Product, cost, quantity, total and taxes (see image below)

enter the description of the image here

Now, what I find strange is that the Total here doesn't add the Tax to the right in this column … is there any way to make a hook that adds this? I've searched html-order-item.php and html-order-items.php, but the tax section looks like a disaster and it's not clear how to add it …

php: only show size attributes in the woocommerce product box when available

First of all, I want to say that I have little experience in coding. I want to show the sizes available in the product box on the store page. I made it work after searching here. Now I just want to show the sizes when there are sizes available. If there are no size attributes available, I would like the text: There are no sizes available or there is no text.


I have the following code now:

add_action (& # 39; woocommerce_after_shop_loop_item_title & # 39 ;, & # 39; display_size_attribute & # 39 ;, 5);
function display_size_attribute () {
$ global product;

if ( $product->is_type('external') ) {
    $taxonomy = 'pa_maat';
    echo "Maten:";
    echo '' . $product->get_attribute($taxonomy) . '';

woocommerce – How to translate text in function.php with WPML

I added this function to add the cash on delivery price and I want to translate the text (cash on delivery) using the WPML plugin

add_action( 'woocommerce_cart_calculate_fees', 'custom_handling_fee', 10, 1 );
function custom_handling_fee ( $cart ) {

    if ( is_admin() && ! defined( 'DOING_AJAX' ) )

    if ( 'cod' === WC()->session->get('chosen_payment_method') ) {
        $fee = 10;
        $cart->add_fee( 'Cash On Delivery', $fee, true );

php – WooCommerce – template_redirect if is_checkout And the order has been paid?

In my WooCommerce store, I would like to redirect to a & # 39; thank you page & # 39; customized after payment is completed. I am using this code:

add_action( 'template_redirect', 'myfunction' );
function myfunction( $order_id ) {

    $order = wc_get_order( $order_id ); // I assume this is where I go wrong. Probably this is empty?

    if ( is_checkout() && 0 == WC()->cart->get_cart_contents_count() ) {
       wp_safe_redirect( home_url() ); // redirect to home if empty cart on checkout page
    } else if ( is_checkout() && **somehow check if $order has been paid?** ) {
        wp_safe_redirect( '' ); // if order has been paid for go here. this never triggers.

I guess my problem is that $ order_id is empty, but my debugging skills stink, so I don't know how to verify it to get started.

I know about $ order-> get_status (). I guess this is called a method? If I try instead of ** ** I get a fatal php error.

Thanks for any help.

woocommerce: file names changed (with strange characters) after loading in cpanel

Then, after opening a thread here and spending hours, I finally managed to identify my problem.

Simply put, many images were not displayed on the site after loading it in the Namecheap hosting (it was created on the local host).

I discovered that, since our images had previously different characters (for example, é), once loaded in the store it became (?), Therefore, no images were shown.

After speaking with namecheap support more than 10 times, they concluded that they cannot do anything.

Now, we have more than 5000 images on the site, so there is no way to edit one by one, since that will take days. I am not even sure if there is a solution for this. please help

woocommerce – Get attributes for the current product

I have code:

$attribute_keys = array_keys( $attributes );

 $options ) : ?>
            get_variation_default_attribute( $attribute_name );
                $args = array( 'options' => $options, 'attribute' => $attribute_name, 'product' => $product, 'selected' => $selected );
                wc_dropdown_variation_attribute_options( $args );

I can get all the custom attributes, but I just need to be selected in the variation tab, because one my product can have 2 variations, another 5 variations

What type of hosting should I take for WooCommerce sites, which will be sold worldwide?


So, I have a client that started with Kickstarter successfully and now wants to sell worldwide. The problem is the speed of the website in other regions besides the EU where the server is located. The obvious choice would be, of course, Cloudflare PRO, but even with the PRO plan site it is not really fast in other regions. And the personalized study to design a custom design for the bags is causing a lot of problems in Cloudflare.

The site has a WPML that slows down the sites. So I thought about buying a server in the USA. UU. And Singapore and perform separate facilities for some important countries to make it faster worldwide. But do any of you think there is a better way? Is there a cloud hosting that makes sites fast worldwide?

I will be really grateful for any ideas.


How to find the right hook to change the woocommerce order refund text box

enter the description of the image here

I'm trying to change this text box in the drop-down box, but I can't find the right hook