Giter VIP home page Giter VIP logo

Comments (8)

lgdelai avatar lgdelai commented on August 19, 2024 1

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.

greguly avatar greguly commented on August 19, 2024 1

Oi Guilherme (@lgdelai),

Agradeça a Kathy aqui: https://www.paypal.com/fundraiser/charity/1451316

Abraços,
Gabriel

from add-to-cart-form-shortcode.

helgatheviking avatar helgatheviking commented on August 19, 2024 1

Very cool... glad you found the tool you need.

from add-to-cart-form-shortcode.

helgatheviking avatar helgatheviking commented on August 19, 2024

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.

lgdelai avatar lgdelai commented on August 19, 2024

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.

lgdelai avatar lgdelai commented on August 19, 2024

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.

lgdelai avatar lgdelai commented on August 19, 2024

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.

helgatheviking avatar helgatheviking commented on August 19, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.