{"id":7129,"date":"2021-06-23T15:51:41","date_gmt":"2021-06-23T07:51:41","guid":{"rendered":"https:\/\/blog.naibabiji.com\/?p=7129"},"modified":"2021-07-08T13:25:20","modified_gmt":"2021-07-08T05:25:20","slug":"woocommerce-extra-button","status":"publish","type":"post","link":"https:\/\/blog.naibabiji.com\/woocommerce\/woocommerce-extra-button.html","title":{"rendered":"\u600e\u4e48\u5728WooCommerce\u8d2d\u7269\u6309\u94ae\u4e0b\u65b9\u6dfb\u52a0\u4e00\u4e2a\u8be2\u76d8\u6309\u94ae\uff1f"},"content":{"rendered":"<p>\u5f88\u591a\u5916\u8d38\u5efa\u7ad9\u7684\u670b\u53cb\u90fd\u4f7f\u7528\u7684WooCommerce\u8fd9\u4e2a\u63d2\u4ef6\u6765\u505a\u4ea7\u54c1\u7cfb\u7edf\uff0c\u800c\u4e00\u4e9b2b\u7684\u7f51\u7ad9\u5e0c\u671b\u5728\u4ea7\u54c1\u754c\u9762\u6dfb\u52a0\u4e00\u4e2a\u8054\u7cfb\u6309\u94ae\u6216\u8005\u8be2\u76d8\u6309\u94ae\uff0c\u524d\u9762\u7ed9\u5927\u5bb6\u4ecb\u7ecd\u8fc7<a href=\"https:\/\/blog.naibabiji.com\/files\/wordpress-woocommerce-quote.html\">\u51e0\u6b3e\u8be2\u76d8\u6309\u94ae\u63d2\u4ef6<\/a>\uff0c\u672c\u6587\u7ed9\u5927\u5bb6\u5206\u4eab\u4e00\u4e0b<strong>\u5982\u4f55\u4f7f\u7528\u4ee3\u7801\u5728WooCommerce\u7684\u8d2d\u7269\u8f66\u6309\u94ae\u4e0b\u65b9\u6dfb\u52a0\u4e00\u4e2a\u81ea\u5b9a\u4e49\u6309\u94ae<\/strong>\u3002<\/p>\n<p><a href=\"https:\/\/edgeone.naibabiji.com\/wp-content\/uploads\/2020\/06\/8fb884bf07e59bdc1eedf1ae44ff67e3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-7130 size-full\" src=\"https:\/\/edgeone.naibabiji.com\/wp-content\/uploads\/2020\/06\/8fb884bf07e59bdc1eedf1ae44ff67e3.png\" alt=\"WooCommerce\u9875\u9762\u65b0\u589e\u6309\u94ae\" width=\"926\" height=\"559\" \/><\/a><\/p>\n<p>\u6548\u679c\u56fe\u5982\u4e0a\uff0c\u5728\u8d2d\u7269\u8f66\u6309\u94ae\u7684\u4e0b\u65b9\u6dfb\u52a0\u4e00\u4e2a\u53ef\u4ee5\u81ea\u5b9a\u4e49\u6309\u94ae\u6587\u5b57\u548c\u94fe\u63a5\u7684\u6309\u94ae\u3002<\/p>\n<p><strong>\u4f7f\u7528\u65b9\u6cd5\uff1a<\/strong><\/p>\n<p>\u590d\u5236\u4e0b\u9762\u7684\u4ee3\u7801\uff0c\u7c98\u8d34\u5230\u4f60\u4e3b\u9898\u7684\u51fd\u6570\u6587\u4ef6functions.php\u91cc\u9762<\/p>\n<pre>add_action( 'woocommerce_single_product_summary', 'my_extra_button_on_product_page', 30 );\r\n\r\nfunction my_extra_button_on_product_page() {\r\n  global $product;\r\n  echo '&lt;a class=\"naibabutton\" href=\"https:\/\/blog.naibabiji.com\"&gt;Contact us immediately&lt;\/a&gt;';\r\n}<\/pre>\n<p>\u4fdd\u5b58\u540e\uff0c\u4f60\u7f51\u7ad9\u524d\u53f0\u5c31\u53ef\u4ee5\u770b\u5230\u4e00\u4e2a\u201cContact us immediately\u201d\u7684\u6309\u94ae\u4e86\u3002\u4e0d\u8fc7\u8fd8\u6ca1\u6709\u6837\u5f0f\u3002<\/p>\n<p>\u81ea\u5df1\u5728\u4e3b\u9898\u7684css\u91cc\u9762\u81ea\u5b9a\u4e49.naibabutton\u7684\u6837\u5f0f\u5c31\u53ef\u4ee5\u4e86\u3002\u5982\u679c\u4f60\u4e0d\u4f1a\u7684\u8bdd\uff0c\u76f4\u63a5\u590d\u5236\u4e0b\u9762\u8fd9\u4e32\u4ee3\u7801\u52a0\u8fdb\u53bb\u5c31\u53ef\u4ee5\u4e86\u3002<\/p>\n<pre>.naibabutton {\r\n    color: #111;\r\n    background-color: rgba(0,0,0,0.1);\r\n    border-style: solid;\r\n    border-width: 1px 1px 1px 1px;\r\n    border-color: #009688;\r\n    padding: 10px;\r\n}<\/pre>\n<p>\u61d2\u5f97\u7814\u7a76\uff1f\u4ed8\u8d39\u5e2e\u4f60\u89e3\u51b3\u3002<a href=\"https:\/\/blog.naibabiji.com\/contact\">\u8054\u7cfb\u6211<\/a><\/p>\n<h2>\u6dfb\u52a0\u4e00\u4e2a\u4e9a\u9a6c\u900a\u8df3\u8f6c\u6309\u94ae<\/h2>\n<p>\u4e0d\u5c11\u5916\u8d38\u4f01\u4e1a\u6709\u4e9a\u9a6c\u900a\u5e97\u94fa\uff0c\u6240\u4ee5\u5e0c\u671b\u81ea\u5df1\u72ec\u7acb\u7ad9\u7684\u4ea7\u54c1\u4ecb\u7ecd\u9875\u9762\u53ef\u4ee5\u52a0\u4e00\u4e2a\u8df3\u8f6c\u5230\u4e9a\u9a6c\u900a\u5e97\u94fa\u7684\u6309\u94ae\uff0c\u60f3\u8981\u5b9e\u73b0\u8fd9\u4e2a\u529f\u80fd\u67093\u79cd\u65b9\u6cd5\u3002<\/p>\n<p>1\u3001\u586b\u5199\u4ea7\u54c1\u7b80\u77ed\u63cf\u8ff0\u7684\u65f6\u5019\u63d2\u5165\u4e00\u4e2a\u6309\u94ae\u3002<\/p>\n<p>2\u3001\u901a\u8fc7\u7c7b\u4f3c\u4e0a\u9762\u5206\u4eab\u7684\u8be2\u76d8\u6309\u94ae\u7684\u65b9\u6cd5\u6dfb\u52a0\u4e00\u4e2a\u4ee3\u7801\u3002<\/p>\n<p>3\u3001\u901a\u8fc7\u63d2\u4ef6\u3002<\/p>\n<p><strong>\u4ee3\u7801\u65b9\u6cd5\uff1a<\/strong><\/p>\n<p>\u8fd9\u91cc\u6211\u91c7\u7528\u7684\u81ea\u5b9a\u4e49\u5b57\u6bb5\u7684\u65b9\u5f0f\u6dfb\u52a0\uff0c\u9996\u5148\u5728woocommerce\u7684\u4ea7\u54c1\u9875\u9762\u6dfb\u52a0\u4e00\u4e2a\u81ea\u5b9a\u4e49\u5b57\u6bb5\uff0c\u4f8b\u5982amazon_link\uff0c\u7136\u540e\u5728amazon_link\u7684\u503c\u91cc\u9762\u586b\u5199\u4e9a\u9a6c\u900a\u7684\u7f51\u5740\u3002<\/p>\n<p>\u63a5\u7740\u628a\u4e0b\u9762\u7684\u4ee3\u7801\u6dfb\u52a0\u5230\u4e3b\u9898\u6587\u4ef6\u91cc\u9762\uff0c\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528<a href=\"https:\/\/blog.naibabiji.com\/tutorial\/wordpress-code-snippets.html\" target=\"_blank\" rel=\"noopener\">Code Snippets<\/a>\u63d2\u4ef6\u6dfb\u52a0\u3002<\/p>\n<pre>add_action( 'woocommerce_single_product_summary', 'my_extra_button_on_product_page', 30 );\r\n\r\nfunction my_extra_button_on_product_page() {\r\nglobal $product;\r\nif ( get_post_meta(get_the_ID(), 'amazon_link', true) ){\r\necho '&lt;a class=\"amazon-button\" href=\"'.get_post_meta(get_the_ID(), 'amazon_link', true).'\" target=\"_blank\"&gt;Buy on Amazon&lt;\/a&gt;';\r\n}\r\n\r\n}\r\nadd_action( 'wp_head', function () { ?&gt;\r\n&lt;style&gt;\r\n.product-desc li:before {\r\ncontent: \"\\f112\";\r\nfont: normal normal normal 16px\/1 LineAwesome;\r\ncolor: #f0494c;\r\n}\r\n.product-desc li {\r\nlist-style: none;\r\npadding-bottom: 7px;\r\n}\r\n.product-desc ul {\r\npadding-left: 0px;\r\n}\r\n&lt;\/style&gt;\r\n&lt;?php } );<\/pre>\n<p>\u4fdd\u5b58\u5b8c\u6bd5\u4e4b\u540e\uff0c\u5f53\u586b\u5199\u4e86\u4e9a\u9a6c\u900aurl\u7684\u4ea7\u54c1\uff0c\u524d\u53f0\u5c31\u4f1a\u591a\u51fa\u6765\u4e00\u4e2a\u4e9a\u9a6c\u900a\u7684\u6309\u94ae\uff0c\u6ca1\u6709\u6dfb\u52a0\u7684\u5219\u4e0d\u4f1a\u663e\u793a\u3002<\/p>\n<p><strong>\u63d2\u4ef6\u65b9\u5f0f\uff1a<\/strong><\/p>\n<p>[vk-content]<\/p>\n<p>\u5b89\u88c5\u4e00\u4e2a<a href=\"https:\/\/woocommerce.com\/products\/quick-buy-now-button-for-woocommerce\/\" target=\"_blank\" rel=\"noopener\">Quick Buy Now Button for WooCommerce<\/a>\u7684\u63d2\u4ef6\uff0c\u7136\u540e\u5728\u7f16\u8f91woocommerce\u4ea7\u54c1\u7684\u65f6\u5019\u5c31\u4f1a\u51fa\u73b0\u5bf9\u5e94\u7684\u8bbe\u7f6e\u6846\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"955\" height=\"347\" class=\"alignnone wp-image-9069 size-full\" src=\"https:\/\/edgeone.naibabiji.com\/wp-content\/uploads\/2020\/06\/Pasted-into-\u600e\u4e48\u5728WooCommerce\u8d2d\u7269\u6309\u94ae\u4e0b\u65b9\u6dfb\u52a0\u4e00\u4e2a\u8be2\u76d8\u6309\u94ae\uff1f.png\" \/><\/p>\n<p>\u81ea\u5df1\u586b\u5199\u4e0abuy on amazon\uff0c\u7136\u540e\u8df3\u8f6c\u9009\u62e9\u81ea\u5b9a\u4e49\u9875\u9762\uff0c\u4e0b\u9762\u8f93\u5165\u7f51\u5740\uff0c\u53d1\u5e03\u4ea7\u54c1\u540e\u5c31\u4f1a\u51fa\u73b0\u4e00\u4e2a\u8df3\u8f6c\u5230\u4e9a\u9a6c\u900a\u7684\u6309\u94ae\u3002\u6ca1\u6709\u81ea\u5df1\u6539\u94fe\u63a5\u5219\u5c31\u662f\u52a0\u4e86\u4e00\u4e2a\u5feb\u901f\u8d2d\u4e70\u7684\u6309\u94ae\u3002<\/p>\n<p>[\/vk-content]<\/p>\n\n\n<div class=\"kk-star-ratings kksr-auto kksr-align-center kksr-valign-bottom\"\n    data-payload='{&quot;align&quot;:&quot;center&quot;,&quot;id&quot;:&quot;7129&quot;,&quot;slug&quot;:&quot;default&quot;,&quot;valign&quot;:&quot;bottom&quot;,&quot;ignore&quot;:&quot;&quot;,&quot;reference&quot;:&quot;auto&quot;,&quot;class&quot;:&quot;&quot;,&quot;count&quot;:&quot;12&quot;,&quot;legendonly&quot;:&quot;&quot;,&quot;readonly&quot;:&quot;&quot;,&quot;score&quot;:&quot;2.8&quot;,&quot;starsonly&quot;:&quot;&quot;,&quot;best&quot;:&quot;5&quot;,&quot;gap&quot;:&quot;4&quot;,&quot;greet&quot;:&quot;\u7ed9\u672c\u6587\u6253\u5206 post&quot;,&quot;legend&quot;:&quot;2.8\\\/5 - (12 votes)&quot;,&quot;size&quot;:&quot;24&quot;,&quot;title&quot;:&quot;\u600e\u4e48\u5728WooCommerce\u8d2d\u7269\u6309\u94ae\u4e0b\u65b9\u6dfb\u52a0\u4e00\u4e2a\u8be2\u76d8\u6309\u94ae\uff1f&quot;,&quot;width&quot;:&quot;76.4&quot;,&quot;_legend&quot;:&quot;{score}\\\/{best} - ({count} {votes})&quot;,&quot;font_factor&quot;:&quot;1.25&quot;}'>\n            \n<div class=\"kksr-stars\">\n    \n<div class=\"kksr-stars-inactive\">\n            <div class=\"kksr-star\" data-star=\"1\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"2\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"3\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"4\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"5\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n    <\/div>\n    \n<div class=\"kksr-stars-active\" style=\"width: 76.4px;\">\n            <div class=\"kksr-star\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n    <\/div>\n<\/div>\n                \n\n<div class=\"kksr-legend\" style=\"font-size: 19.2px;\">\n            2.8\/5 - (12 votes)    <\/div>\n    <\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u5f88\u591a\u5916\u8d38\u5efa\u7ad9\u7684\u670b\u53cb\u90fd\u4f7f\u7528\u7684WooCommerce\u8fd9\u4e2a\u63d2\u4ef6\u6765\u505a\u4ea7\u54c1\u7cfb\u7edf\uff0c\u800c\u4e00\u4e9b2b\u7684\u7f51\u7ad9\u5e0c\u671b\u5728\u4ea7\u54c1\u754c\u9762\u6dfb\u52a0\u4e00\u4e2a\u8054 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":7131,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"slim_seo":{"title":"\u600e\u4e48\u5728WooCommerce\u8d2d\u7269\u6309\u94ae\u4e0b\u65b9\u6dfb\u52a0\u4e00\u4e2a\u8be2\u76d8\u6309\u94ae\uff1f - \u5976\u7238\u5efa\u7ad9\u7b14\u8bb0","description":"\u5f88\u591a\u5916\u8d38\u5efa\u7ad9\u7684\u670b\u53cb\u90fd\u4f7f\u7528\u7684WooCommerce\u8fd9\u4e2a\u63d2\u4ef6\u6765\u505a\u4ea7\u54c1\u7cfb\u7edf\uff0c\u800c\u4e00\u4e9b2b\u7684\u7f51\u7ad9\u5e0c\u671b\u5728\u4ea7\u54c1\u754c\u9762\u6dfb\u52a0\u4e00\u4e2a\u8054\u7cfb\u6309\u94ae\u6216\u8005\u8be2\u76d8\u6309\u94ae\uff0c\u524d\u9762\u7ed9\u5927\u5bb6\u4ecb\u7ecd\u8fc7 \u51e0\u6b3e\u8be2\u76d8\u6309\u94ae\u63d2\u4ef6 \uff0c\u672c\u6587\u7ed9\u5927\u5bb6\u5206\u4eab\u4e00\u4e0b \u5982\u4f55\u4f7f\u7528\u4ee3\u7801\u5728WooCommerce\u7684\u8d2d\u7269\u8f66\u6309\u94ae\u4e0b\u65b9\u6dfb\u52a0\u4e00\u4e2a\u81ea\u5b9a\u4e49\u6309\u94ae \u3002 \u6548\u679c\u56fe\u5982\u4e0a\uff0c\u5728\u8d2d\u7269\u8f66\u6309\u94ae\u7684\u4e0b\u65b9\u6dfb\u52a0\u4e00\u4e2a\u53ef\u4ee5\u81ea\u5b9a\u4e49\u6309\u94ae\u6587\u5b57"},"footnotes":""},"categories":[405],"tags":[],"class_list":["post-7129","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-woocommerce"],"_links":{"self":[{"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/posts\/7129","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/comments?post=7129"}],"version-history":[{"count":0,"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/posts\/7129\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/media\/7131"}],"wp:attachment":[{"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/media?parent=7129"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/categories?post=7129"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/tags?post=7129"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}