Home Forums Basel support forum Price and quantity wrap

Price and quantity wrap

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #10790

    Tess
    Participant

    Hi

    My client wants me to add a price swap plus quantity on products as per the website link below

    What is the correct css code to do this? Can this be done in the theme product settings?

    Below is code taken from the website link

    .basel-hover-alt.product-type-external .btn-add, .basel-hover-alt.product-type-external .price, .basel-hover-alt.product-type-external .wrapp-swap, .basel-hover-alt.product-type-grouped .btn-add, .basel-hover-alt.product-type-grouped .price, .basel-hover-alt.product-type-grouped .wrapp-swap, .basel-hover-alt.purchasable .btn-add, .basel-hover-alt.purchasable .price, .basel-hover-alt.purchasable .wrapp-swap

    Attachments:
    You must be logged in to view attached files.
    #10792

    Artem Temos
    Keymaster

    Hello,

    Thank you for choosing our theme and contacting us.

    Actually, it can’t be done with CSS code only. Here is an article that should help you https://docs.woocommerce.com/document/override-loop-template-and-show-quantities-next-to-add-to-cart-buttons/

    Kind Regards
    XTemos Studio

    #25743

    Tess
    Participant

    Hi Artem. This code worked for a while, but since the theme update, the item does not add to the cart. Please help – it is for the same client as per previous enquiry.

    .add_filter( ‘woocommerce_loop_add_to_cart_link’, ‘quantity_inputs_for_woocommerce_loop_add_to_cart_link’, 10, 2 );

    function quantity_inputs_for_woocommerce_loop_add_to_cart_link( $html, $product ) {
    if ( $product && $product->is_type( ‘simple’ ) && $product->is_purchasable() && $product->is_in_stock() && ! $product->is_sold_individually() ) {
    $html = ‘<form action=”‘ . esc_url( $product->add_to_cart_url() ) . ‘” class=”cart” method=”post” enctype=”multipart/form-data”>’;
    $html .= woocommerce_quantity_input( array(), $product, false );
    $html .= ‘<button type=”submit” class=”button alt”>’ . esc_html( $product->add_to_cart_text() ) . ‘</button>’;
    $html .= ‘</form>’;
    }
    return $html;
    }

    #25744

    Artem Temos
    Keymaster

    Hello,

    Did you check how it works with default WordPress theme? Is this issue related to our Basel theme?

    Regards

    #25756

    Tess
    Participant

    The code is in the Basel Child theme, as per before. My question is: Is the error due to theme upgrade? I need to get it to work.

    #25757

    Artem Temos
    Keymaster

    We don’t know since this code is not a part of our theme and you have added it by your own. But the code may be not working with the latest version of the WooCommerce plugin. Anyway, it can’t be caused by our theme. And you can check it adding this code to default WordPress theme.

Viewing 6 posts - 1 through 6 (of 6 total)