{"id":12547,"date":"2024-08-17T11:34:47","date_gmt":"2024-08-17T03:34:47","guid":{"rendered":"https:\/\/blog.naibabiji.com\/?p=12547"},"modified":"2024-08-17T11:34:49","modified_gmt":"2024-08-17T03:34:49","slug":"how-to-display-a-single-variable-product-page-on-homepage-in-woocommerce","status":"publish","type":"post","link":"https:\/\/blog.naibabiji.com\/news\/how-to-display-a-single-variable-product-page-on-homepage-in-woocommerce.html","title":{"rendered":"\u600e\u4e48\u5728WordPress\u9996\u9875\u5c55\u793a\u67d0\u6b3e\u4ea7\u54c1\u7684\u8be6\u7ec6\u8d2d\u4e70\u754c\u9762"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u5728\u6211\u4eec\u7ed9\u5ba2\u6237\u5236\u4f5c\u7535\u5546\u7f51\u7ad9\u7684\u65f6\u5019\uff0c\u6709\u4e9b\u670b\u53cb\u5e0c\u671b\u53ef\u4ee5\u76f4\u63a5\u6253\u5f00\u7f51\u7ad9\u9996\u9875\u5c31\u770b\u5230\u67d0\u6b3e\u5355\u54c1\u7684\u8d2d\u4e70\u754c\u9762\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5e38\u89c4\u7684\uff0c\u6211\u4eec\u901a\u8fc7WooCommerce\u6bb5\u4ee3\u7801\u6216\u8005\u5176\u4ed6\u6784\u5efa\u5668\u5728\u9996\u9875\u6dfb\u52a0\u4ea7\u54c1\uff0c\u90fd\u662f\u5c55\u793a\u7684\u4ea7\u54c1\u56fe\u7247\u548c\u6807\u9898\uff0c\u9700\u8981\u70b9\u51fb\u56fe\u7247\u548c\u6807\u9898\u8fdb\u5165\u4ea7\u54c1\u8be6\u60c5\u9875\uff0c\u7136\u540e\u624d\u80fd\u770b\u5230\u8d2d\u4e70\u754c\u9762\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u800c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u4e0b\u9762\u7684\u65b9\u6cd5\u5b9e\u73b0\u76f4\u63a5\u5728\u9996\u9875\u5c55\u793a\u67d0\u6b3e\u4ea7\u54c1\u7684\u8be6\u60c5\u9875\uff0c\u5b9e\u73b0\u5728\u9996\u9875\u5373\u53ef\u9009\u62e9\u4ea7\u54c1\u7684\u53d8\u91cf\u5e76\u8fdb\u884c\u8d2d\u4e70\u64cd\u4f5c\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1\u3001\u7f16\u8f91\u9996\u9875\uff0c\u63d2\u5165\u77ed\u4ee3\u7801<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#091;product_page id=\"99\"]<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0a\u9762\u4ee3\u7801\u4e2d\u768499\u8bf7\u4f7f\u7528\u4f60\u81ea\u5df1\u7684\u4ea7\u54c1id\u66ff\u4ee3\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2\u3001\u5728\u4e3b\u9898\u51fd\u6570\u91cc\u9762\u6dfb\u52a0\u4e0b\u9762\u4ee3\u7801\uff0c\u9690\u85cf\u4ea7\u54c1\u7684\u5176\u4ed6\u6742\u7c7b\u4fe1\u606f<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>add_action( 'template_redirect', 'remove_after_single_product_section_on_home', 1 );\nfunction remove_after_single_product_section_on_home(){\n\n    \/\/ On home page only\n    if( is_front_page() ) {\n        remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 10 ); \/\/ Product tabs\n        remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 15 ); \/\/ Upsells\n        remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 ); \/\/ Related products\n    }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/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;12547&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;5&quot;,&quot;legendonly&quot;:&quot;&quot;,&quot;readonly&quot;:&quot;&quot;,&quot;score&quot;:&quot;3.4&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;3.4\\\/5 - (5 votes)&quot;,&quot;size&quot;:&quot;24&quot;,&quot;title&quot;:&quot;\u600e\u4e48\u5728WordPress\u9996\u9875\u5c55\u793a\u67d0\u6b3e\u4ea7\u54c1\u7684\u8be6\u7ec6\u8d2d\u4e70\u754c\u9762&quot;,&quot;width&quot;:&quot;93.2&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: 93.2px;\">\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            3.4\/5 - (5 votes)    <\/div>\n    <\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u6211\u4eec\u7ed9\u5ba2\u6237\u5236\u4f5c\u7535\u5546\u7f51\u7ad9\u7684\u65f6\u5019\uff0c\u6709\u4e9b\u670b\u53cb\u5e0c\u671b\u53ef\u4ee5\u76f4\u63a5\u6253\u5f00\u7f51\u7ad9\u9996\u9875\u5c31\u770b\u5230\u67d0\u6b3e\u5355\u54c1\u7684\u8d2d\u4e70\u754c\u9762\u3002 \u5e38\u89c4\u7684\uff0c\u6211\u4eec\u901a\u8fc7W [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"slim_seo":{"title":"\u600e\u4e48\u5728WordPress\u9996\u9875\u5c55\u793a\u67d0\u6b3e\u4ea7\u54c1\u7684\u8be6\u7ec6\u8d2d\u4e70\u754c\u9762 - \u5976\u7238\u5efa\u7ad9\u7b14\u8bb0","description":"\u5728\u6211\u4eec\u7ed9\u5ba2\u6237\u5236\u4f5c\u7535\u5546\u7f51\u7ad9\u7684\u65f6\u5019\uff0c\u6709\u4e9b\u670b\u53cb\u5e0c\u671b\u53ef\u4ee5\u76f4\u63a5\u6253\u5f00\u7f51\u7ad9\u9996\u9875\u5c31\u770b\u5230\u67d0\u6b3e\u5355\u54c1\u7684\u8d2d\u4e70\u754c\u9762\u3002 \u5e38\u89c4\u7684\uff0c\u6211\u4eec\u901a\u8fc7WooCommerce\u6bb5\u4ee3\u7801\u6216\u8005\u5176\u4ed6\u6784\u5efa\u5668\u5728\u9996\u9875\u6dfb\u52a0\u4ea7\u54c1\uff0c\u90fd\u662f\u5c55\u793a\u7684\u4ea7\u54c1\u56fe\u7247\u548c\u6807\u9898\uff0c\u9700\u8981\u70b9\u51fb\u56fe\u7247\u548c\u6807\u9898\u8fdb\u5165\u4ea7\u54c1\u8be6\u60c5\u9875\uff0c\u7136\u540e\u624d\u80fd\u770b\u5230\u8d2d\u4e70\u754c\u9762\u3002 \u800c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u4e0b\u9762\u7684\u65b9\u6cd5\u5b9e\u73b0\u76f4\u63a5\u5728\u9996\u9875\u5c55\u793a\u67d0\u6b3e\u4ea7\u54c1\u7684\u8be6\u60c5\u9875\uff0c\u5b9e\u73b0\u5728\u9996\u9875"},"footnotes":""},"categories":[1],"tags":[],"class_list":["post-12547","post","type-post","status-publish","format-standard","hentry","category-news"],"_links":{"self":[{"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/posts\/12547","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=12547"}],"version-history":[{"count":0,"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/posts\/12547\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/media?parent=12547"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/categories?post=12547"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/tags?post=12547"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}