You can use the shortcodes provided by WooCommerce.
-
To get the whole button with your custom class and AJAX functionalities..
<?php echo do_shortcode('[add_to_cart id="' . get_the_ID() . '" class="add_to_cart_button btn btn-outline-primary btn-lg"]');?>
-
Or, just the URL to use with your custom button.
<a href="<?php echo do_shortcode('[add_to_cart_url id="' . get_the_ID() . '"]');?>" class="add_to_cart_button btn btn-outline-primary btn-lg">Přidat do košíku</a>
Related Posts:
- Where do I find the functions triggered within a hook?
- Writing Clean WooCommerce Styles
- Cannot update WordPress General Settings Site Title and Tagline
- How do I update WooCommerce template files in my theme? [closed]
- Unhook action from child theme
- A mystery 300px image size
- How to call WooCommerce update cart function programatically
- How to override checkbox styles if these inputs have a unique id [closed]
- Custom Field created in add_meta_boxes reappearing itself again in the default Custom Metabox
- How to add material design css in wordpress and woocommerce
- Storefront child theme not applying parent theme [closed]
- StoreFront product pages: Turn the Short Description section into a kindred tab section [closed]
- How can I fetch the WordPress cart errors normally displayed in woocommerce-error?
- page.php dependent sites are not working in custom woocommerce theme
- Zoom on custom theme without child
- Scroll to position on page for category pages only — woocommerce
- Can’t remove DIV from hooks in Storefront child theme [closed]
- Integrate WooCommerce theme with a WordPress theme [closed]
- What is the diferences between pure WordPress theme and Woocommerce theme? [closed]
- why mytheme/single-product.php works but not mytheme/woocommerce/single-product.php
- Why does admin-ajax load slow and what are ways to speed it up?
- Adding an external link to product grid list pages for woocommerce
- Issue when posting updates/changes to wordress
- Want to add cart and a search bar in the right of logo line
- Woocommerce Product attribute not imported with wordpress Importer [closed]
- Add a field to the taxonomy editor?
- how to add a badge on product based on filter?
- Woocommerce AJAX filters option loading spiner – problem on mobile device
- How do I make my terms for each product display via foreach loop? (woocommerce)
- Best way to declare product variables in woocommerce theme development?
- Alter shop page lay-out in OceanWP theme
- Is it possible to echo a woocommerce prouct attribute discription?
- the_content() not displaying description correctly
- Woocommerce REST API for my account & checkout process
- Edit Product Archive design for Woo theme
- How to show Custom Field Value in Woocommerce Shop Page
- how to edit woocommerce checkout page
- How to fix a conflict cause by my theme with Woocommerce and/or Gravity Forms?
- WooCommerce – edit templates
- Woocommerce Theme Reviews / Comments
- php file child theme directory not overriding parent theme php file [duplicate]
- Pagination adds product to cart Woo-Commerce
- How to change order of elements using a child theme
- How to install Woocommerce without plugin?
- How can i move my product name & price from below thumbnail to be the rollover content in Avada & Woocommerce?
- Cart button not working on mobile version [closed]
- Add text when displying attribute with a hook on single product page
- How to enable wc_add_to_cart_message?
- WordPress API Menu/Submenu Order
- What WP folder can I use to write files to?
- Form Submitting Error with get_template_part()
- Can’t get staging site to display same way as live site. Completely stumped
- Display a different theme for not logged-in users
- how to test a theme upgrade
- How to add paging to query
- what’s meaning of it when submit a theme?
- How to Modify a Widgets UL and/or LI Classes
- How to remove menus section from WordPress theme customizer
- What page should I use for a contact form?
- Get attachments by user
- Appending a value to metabox before and after saving
- I made a my own theme to WordPress and Admin Menu missing from frontend
- What program can I use to preview my wordpress site?
- How to remove a file included in parent theme with locate_template() via child theme?
- Can’t override template file in child theme
- Simple way to get two language WP site
- jQuery not available to other scripts
- Does the switch_theme action run when you’re upgrading a theme?
- How to jump to newly posted comment anchor after submit?
- Can I use WooCommerce in a headless CMS setup?
- adding class to excerpt
- How can I wrap all blog posts image with
- Redux Setting on custom created admin page
- Never actually adding the action? Or do I have to call the action?
- How can I remove image taxonomy pages from my theme and from Google?
- How can I get dynamic content on my static home page
- WordPress 6.x / PHP 8.x deprecated warnings in development environment
- WordPress custom menu can’t show 3. level submenu
- Social-Link block not loading html on page with custom theme
- Custom Static Page to Display Blog Posts in Excerpt Non-Singular Form (is_singular not working?)
- Importing sass into underscores theme
- How can I fix my theme header for my CSS stylesheet?
- Alternative solution for script_loader_tag?
- Change logo url by category and in some pages
- Enqueue script for development purposes only?
- style.css not being rendered in browser
- Correct (and secure) way to escape url when using href attribute
- “Add media” dialog is not showing any images
- How to debug theme (Theme is causing pages to have no style or HTML section)
- How to get the Clicked ID and output that ID data in another page
- Two theme options pages for a theme
- Strict Standards Error bootstrap navwalker
- Ubuntu 13.04 create new wordpress theme from scratch problems
- Confused on loading page content
- Problem dynamically generating an all purpose title tag
- Loop inside page template not working
- why my WordPress theme doesn’t support shortcode? [closed]
- I’m new in developing responsive WordPress Theme, so which framework to use or work from scratch? [closed]
- Block to show posts from same category
- How can I enforce user to use Application password to generate JWT token? [closed]