Comments (8)
I found a very simple plugin that does what I need.
I think I will use it.
https://br.wordpress.org/plugins/quantity-field-on-shop-page-for-woocommerce/
Displays quantity field on all products (including shortcode) and works with ajax.
It just doesn't display variations like yours.
I think I'll use it, it's a very simple plugin, like yours, it only has 1 php file and another css.
Thank you so much for sharing your knowledge with me.
Helped me a lot.
from add-to-cart-form-shortcode.
Oi Guilherme (@lgdelai),
Agradeça a Kathy aqui: https://www.paypal.com/fundraiser/charity/1451316
Abraços,
Gabriel
from add-to-cart-form-shortcode.
Very cool... glad you found the tool you need.
from add-to-cart-form-shortcode.
Download the zip from github: https://github.com/helgatheviking/add-to-cart-form-shortcode/archive/refs/heads/master.zip and install it as a WordPress plugin.
Then you should be able to use the shortcode as described... ie: [add_to_cart_form id="99"]
I'm not familiar with ContentViews and can't really provide any advice for that.
from add-to-cart-form-shortcode.
Got it,
Your plugin displays the quantity fields.
But it doesn't use ajax when I click add to cart.
Look: https://roquesburger.com/
from add-to-cart-form-shortcode.
I'm not familiar with ContentViews and can't really provide any advice for that.
This is the part of the ContentView code that displays the shortcode, maybe this will help.
// Show Price
'price' case:
if ( $post_type === 'product' ) {
$html = do_shortcode( sprintf( '[add_to_cart id="%s" style=""]', $post->ID ) );
}
break;
For your plugin to work I replace it
[add_to_cart
per
[add_to_cart_form
In the code above. But as I said, he is not using ajax to add to cart.
Is it possible to adjust this?
from add-to-cart-form-shortcode.
Obs.: Without using your plugin, as native shortcode.
The button works with Ajax. (However the quantity field is not displayed)
What I'm trying to do is make the button work with ajax and with the quantity field also being displayed.
This code:
https://gist.github.com/webaware/6260468
Makes the quantity field display all over the site, and it works with ajax (It doesn't work in shortcodes, however)
Yours already works in Shortcodes, (but it doesn't use ajax).
It's a very complicated situation.
Do you think it's possible to adjust your plugin so that it works in ajax?
from add-to-cart-form-shortcode.
But it doesn't use ajax
No, it doesn't. That's expected (and in line with Woo's default single product page). I'm sure it could be adjusted to use ajax.
A button needs to have add_to_cart_button
and ajax_add_to_cart
and the data-product_id
attribute for it to automatically have the WooCommerce ajax add to scripts handle that for you.
You would need to change the shortcode's output to be sure all those classes and attributes are present. And then Woo's default script might handle it for you... though I am not sure about who it handles quantity off the top of my head.
from add-to-cart-form-shortcode.
Related Issues (10)
- add_shortcode on woocommerce_loaded hook
- Missing notices
- Multiple shortcodes on the same page HOT 1
- Support ajax add to cart
- Add param to control redirect HOT 1
- yith Booking and Appointment for WooCommerce HOT 1
- Detect current page query from inside the shortcode.
- Recent Woo update broke plugin with variable products? HOT 1
- Declare compatibility with the 'High-Performance order storage' feature. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from add-to-cart-form-shortcode.