久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

Woocommerce - 產(chǎn)品頁(yè)面 - 如何在“添加到購(gòu)物車&q

Woocommerce - Product Page - How to create AJAX on quot;Add To Cartquot; button?(Woocommerce - 產(chǎn)品頁(yè)面 - 如何在“添加到購(gòu)物車上創(chuàng)建 AJAX按鈕?)
本文介紹了Woocommerce - 產(chǎn)品頁(yè)面 - 如何在“添加到購(gòu)物車"上創(chuàng)建 AJAX按鈕?的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問(wèn)題描述

我想在可以使用 AJAX 的產(chǎn)品頁(yè)面上制作一個(gè)添加到購(gòu)物車"按鈕.我該怎么做?當(dāng)我在產(chǎn)品頁(yè)面上添加到購(gòu)物車時(shí) - 它會(huì)刷新頁(yè)面,我如何通過(guò) AJAX 使其工作?

I want to make an "Add To Cart" button on a product page that would work with AJAX. How can I do it? When I add to cart on a product page - it refreshes the page, how can I make it work by AJAX?

存檔中快速查看"上的添加到購(gòu)物車"按鈕由 ajax 工作 - 這很棒,但我如何在產(chǎn)品頁(yè)面上做同樣的事情?

The "Add to cart" button on "Quick View" on archive works by ajax - and it's great, but how can I do the same on product page?

我想點(diǎn)擊產(chǎn)品頁(yè)面上的帶我回家",然后通過(guò) ajax 將具有選定屬性的產(chǎn)品添加到我的購(gòu)物車,然后打開(kāi)該購(gòu)物車(就像您將鼠標(biāo)懸停在菜單上的包圖片上一樣)并搖晃包圖片.

I want to click on "Take me Home" on the product page which would then add the product with the selected attributes to my cart by ajax and will open that cart (like when you hover onto the bag image on menu) and shakes the bag image.

推薦答案

只需將以下屬性添加到添加到購(gòu)物車"按鈕即可啟用 Ajax 按鈕.

Just add the following attributes to the Add to Cart button to enable the Ajax button.

<a href="<?php echo $product->add_to_cart_url() ?>" value="<?php echo esc_attr( $product->get_id() ); ?>" class="ajax_add_to_cart add_to_cart_button" data-product_id="<?php echo get_the_ID(); ?>" data-product_sku="<?php echo esc_attr($sku) ?>" aria-label="Add "<?php the_title_attribute() ?>" to your cart"> Add to Cart </a>

ajax_add_to_cart add_to_cart_button 類,以及 data-product_id="<?php echo get_the_ID();?>>data-product_sku="" 屬性是必需的.

The ajax_add_to_cart add_to_cart_button classes, and the data-product_id="<?php echo get_the_ID(); ?>" data-product_sku="<?php echo esc_attr($sku) ?>" attributes are required.

無(wú)需應(yīng)用任何操作或過(guò)濾器.

No need to apply any action or filter.

這篇關(guān)于Woocommerce - 產(chǎn)品頁(yè)面 - 如何在“添加到購(gòu)物車"上創(chuàng)建 AJAX按鈕?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Session is lost after an OAuth redirect(OAuth 重定向后會(huì)話丟失)
Pagination Sort in Cakephp 3.x(Cakephp 3.x 中的分頁(yè)排序)
CakePHP Shared core for multiple apps(CakePHP 多個(gè)應(yīng)用程序的共享核心)
Login [ Auth-gt;identify() ] always false on CakePHP 3(在 CakePHP 3 上登錄 [ Auth-identify() ] 始終為 false)
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 87 bytes)(致命錯(cuò)誤:允許的內(nèi)存大小為 134217728 字節(jié)已用盡(嘗試分配 87 字節(jié)))
主站蜘蛛池模板: 自拍在线 | 91丨国产| 成人在线精品视频 | 亚洲视频精品在线 | 欧美日韩国产一区二区三区 | 一区二区三区高清 | 狠狠综合久久av一区二区小说 | 国产一级特黄视频 | 成人免费视频网站在线观看 | 色狠狠一区 | 国产精品美女久久久久aⅴ国产馆 | 免费在线观看一区二区 | 精品久久久久一区 | 日韩精品一区二区三区在线播放 | 免费一级毛片 | 亚洲福利一区二区 | 鸳鸯谱在线观看高清 | 欧美一区二区三区高清视频 | 91在线观看| 国产一区在线免费 | 成人不卡| 啪啪毛片 | 午夜影院网站 | 久久精品国产一区 | 欧美a区| 91超碰在线 | 亚洲精品第一国产综合野 | 一区二区在线免费观看 | 999在线精品| 久草中文在线 | 精品在线一区二区三区 | 亚洲一区 中文字幕 | 精品少妇一区二区三区在线播放 | 欧美一区二区三区在线 | 国产三级电影网站 | 精品麻豆剧传媒av国产九九九 | 一区二区三区日韩精品 | 精品一二三 | 在线日韩| 精品久久久精品 | 天色综合网 |