Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with offcanvas #200

Closed
ghost opened this issue Aug 5, 2022 · 8 comments · Fixed by #329
Closed

Problem with offcanvas #200

ghost opened this issue Aug 5, 2022 · 8 comments · Fixed by #329

Comments

@ghost
Copy link

ghost commented Aug 5, 2022

No description provided.

@crftwrk crftwrk transferred this issue from bootscore/bootcommerce-child Aug 5, 2022
@crftwrk
Copy link
Member

crftwrk commented Aug 5, 2022

Offcanvas cart opens when you add something to the cart. This is what a cart exactly should do and works fine with:

  • Simple products
  • Variable products
  • Grouped Products

Works not with:

  • Affiliate products

Please describe issue more detailed and share a link to your project to check your issue.

Thanks!

@crftwrk
Copy link
Member

crftwrk commented Aug 5, 2022

Unfortunately it’s absolutely impossible to check something on your local machine. That‘s why specific problems must have a link with live example as described here https://bootscore.me/documentation/support-contribute/#What_we_do

Please transfer your project to a public server and share links to the pages where your issue appears and describe each. So, we can check and help.

Thank you!

@justinkruit
Copy link
Member

justinkruit commented Aug 5, 2022

If you don't want the offcanvas to happen on that button, you should add the .product_type_woosg class to the :not checks on this line:

$('.single_add_to_cart_button:not(.product_type_variable):not(.product_type_external):not(.product_type_grouped)').attr('data-bs-toggle', 'offcanvas').attr('data-bs-target', '#offcanvas-cart');

@crftwrk instead of checking all the :not, can't we just check if it's a simple product?

Excuse the comment if it has any weird formatting, doing this support from my phone.

@ghost ghost closed this as completed Aug 6, 2022
@crftwrk
Copy link
Member

crftwrk commented Aug 8, 2022

instead of checking all the :not, can't we just check if it's a simple product?

@justinkruit yes, better. Do you have any idea to solve this in product pages for grouped and variable products? Because they use the single_add_to_cart_button as well.

If we do something like $('.product-type-simple .single_add_to_cart_button').attr('data-bs-toggle', 'offcanvas').attr('data-bs-target', '#offcanvas-cart'); it will work in product loop but not in product pages.

Any idea?

@justinkruit
Copy link
Member

Just did some testing, and I ended up with the same jQuery function, although for me it works on both the category page and the product page. Are you sure it wasn't working @crftwrk ?

@crftwrk
Copy link
Member

crftwrk commented Aug 11, 2022

Did you tested it with grouped and variable products?

@justinkruit
Copy link
Member

Ah, I see what you mean now. Fixed it with this:
$('body.archive .product-type-simple .single_add_to_cart_button, body.single-product .single_add_to_cart_button').attr('data-bs-toggle', 'offcanvas').attr('data-bs-target', '#offcanvas-cart');

@crftwrk
Copy link
Member

crftwrk commented Aug 11, 2022

PR?

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants