{"id":3763,"date":"2020-06-16T12:22:00","date_gmt":"2020-06-16T12:22:00","guid":{"rendered":"https:\/\/purelysupp.com\/wordpress\/?p=3763"},"modified":"2022-10-16T13:12:20","modified_gmt":"2022-10-16T13:12:20","slug":"change-the-number-of-woocommerce-related-products","status":"publish","type":"post","link":"https:\/\/purelysupp.com\/wordpress\/code-snippets\/change-the-number-of-woocommerce-related-products\/","title":{"rendered":"Change the number of WooCommerce Related Products"},"content":{"rendered":"\n<p>Add the following code to your theme&#8217;s function.php file, or a functionality plugin to modify the number of WooCommerce Related Products that are displayed.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\n\n\/**\n * Change number of related products output\n *\/\nfunction woo_related_products_limit() {\n  global $product;\n\n\t$args&#91;'posts_per_page'] = 6;\n\treturn $args;\n}\nadd_filter( 'woocommerce_output_related_products_args', 'jk_related_products_args' );\n  function jk_related_products_args( $args ) {\n\t$args&#91;'posts_per_page'] = 3; \/\/ 4 related products\n\t$args&#91;'columns'] = 3; \/\/ arranged in 2 columns\n\treturn $args;\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Add the following code to your theme&#8217;s function.php file, or a functionality plugin to modify the number of WooCommerce Related Products that are displayed.<\/p>\n","protected":false},"author":1,"featured_media":10631,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","iawp_total_views":2,"wds_primary_category":56,"footnotes":""},"categories":[56],"tags":[110,217,204],"class_list":{"0":"post-3763","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-code-snippets","8":"tag-code","9":"tag-related-products","10":"tag-woocommerce","11":"entry"},"featured_image_src":"https:\/\/purelysupp.com\/wordpress\/wp-content\/uploads\/sites\/2\/2022\/09\/woocommerce-code_snippets-600x303.jpg","featured_image_src_square":"https:\/\/purelysupp.com\/wordpress\/wp-content\/uploads\/sites\/2\/2022\/09\/woocommerce-code_snippets-600x303.jpg","author_info":{"display_name":"Jack Alltrade","author_link":"https:\/\/purelysupp.com\/wordpress\/author\/jacka11trade\/"},"_links":{"self":[{"href":"https:\/\/purelysupp.com\/wordpress\/wp-json\/wp\/v2\/posts\/3763","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/purelysupp.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/purelysupp.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/purelysupp.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/purelysupp.com\/wordpress\/wp-json\/wp\/v2\/comments?post=3763"}],"version-history":[{"count":3,"href":"https:\/\/purelysupp.com\/wordpress\/wp-json\/wp\/v2\/posts\/3763\/revisions"}],"predecessor-version":[{"id":10663,"href":"https:\/\/purelysupp.com\/wordpress\/wp-json\/wp\/v2\/posts\/3763\/revisions\/10663"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/purelysupp.com\/wordpress\/wp-json\/wp\/v2\/media\/10631"}],"wp:attachment":[{"href":"https:\/\/purelysupp.com\/wordpress\/wp-json\/wp\/v2\/media?parent=3763"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/purelysupp.com\/wordpress\/wp-json\/wp\/v2\/categories?post=3763"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/purelysupp.com\/wordpress\/wp-json\/wp\/v2\/tags?post=3763"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}