在 WooCommerce 小部件侧边栏中获取相关产品
Get related Products in the WooCommerce widget Sidebar
有谁知道如何将相关产品放在 WooCommerce 的侧边栏中?
类似于此屏幕截图:
1) 您可以使用此代码在文本小部件中启用简码执行
// Enable shortcode execution in text widget
add_filter ('widget_text', 'do_shortcode');
代码进入您的活动子主题(或主题)的 function.php 文件或任何插件文件。
2) 然后在 Wordpress 小部件中,您将能够添加和使用添加到其中的文本小部件:
[related_products per_page="4" columns="1"]
But you will have to make some custom CSS for it, to get the display that you want… Or to build your own custom widget (or shortcode).
有谁知道如何将相关产品放在 WooCommerce 的侧边栏中?
类似于此屏幕截图:
1) 您可以使用此代码在文本小部件中启用简码执行
// Enable shortcode execution in text widget
add_filter ('widget_text', 'do_shortcode');
代码进入您的活动子主题(或主题)的 function.php 文件或任何插件文件。
2) 然后在 Wordpress 小部件中,您将能够添加和使用添加到其中的文本小部件:
[related_products per_page="4" columns="1"]
But you will have to make some custom CSS for it, to get the display that you want… Or to build your own custom widget (or shortcode).