Sort and display products by custom field or Meta


sap-xp-and-show-product-wooc-follow-the-policy-meta

Sort and display products by custom field or Meta - WooCommerce Organizing and displaying products is an important storage function that makes an important component of the user experience. The ability to sort the product list in the order of priority agreed to visitors to select the appropriate product quickly, continue transactions.


Sort and display WooCommerce products with two types: Default / Custom. custom WooCommerce product taxonomy is usually done using hooks.


Sorting and displaying product catalogs by custom fields / by other post meta value helps customers browse WooCommerce website with you a lot. This option adds a useful way to organize inventory so customers discover products they have not previously seen.


Today, I will first describe the custom field and then highlight how to add this WooCommerce sorting option to the product page.


Add custom fields to the Woo commercial product


You conveniently add custom fields to all WooCommerce products by entering them with custom fields set as post meta. This agrees you to set meta post for all products.


install-and-present-product-wagering-by-school-meta-capital


Once completed, you will now be able to add values ​​based on text and numbers as post meta information. Customers now arrange products by using this value.


WooC Commercial Products Sort and display by custom fields


WooTheme is very useful in terms of layout. However, it does not mention the meta value interface. This metal value is used to set up the sort filter using both numbers and text.


To show the concept, I will add two sorting options: Sort by position, Sort by points.


install-and-present-product-based-wagering-meta-capital


install-and-present-product-wagons-following-statutory-format-format


See more: How to create a Landing Page


How will the product display?


On the product page, this option is now added to the sort filter drop-down menu.


install-and-present-product-wagons-following-the-policy-meta


The following code snippet shows the location, point of sale at the website. Using this function, you can display any custom field on your website by passing meta values.


install-and-present-product-wagering-by-school-meta-capital


Now whenever you select sort option, the corresponding sort argument will be used. Screen shot showing sorting options: active location.


install-and-present-product-distribution-wagering-meta-capital


Similarly, when arranging for a Point of Sale, the output will be:


install-and-display-product-wagons-following-the-policy-meta


Now if you try to do this at the Edit product screen, the product screen requires setting a value for the custom field.


install-and-display-product-wagons-following-the-policy-meta


Sort default WooCommerce products


To enable default WooCommerce product sorting, simply visit WooCommerce Settings> Product Tab.


install-and-present-product-distribution-wagering-meta-data


At the drop-down list, you see the default sorting option available that focuses on price parameters, popularity.


To view this sorting parameter in action, visit the Products page. Click the Sort products tab, select the desired parameters. The results on the page will change to reflect your selection.


install-and-present-product-wagering-by-school-meta-capital


If you want to apply custom layers or want to change the order of parameter menu arrangements, you do so by going to Products> Advanced and then on the Order Menu option. Behind the scenes, this action uses the WooCommerce _catalog_orderby hook.


install-and-present-product-wagering-by-school-meta-capital


Add custom sorting options for WooCommerce products


If you think the available sorting parameters are not enough for the purpose you want, you can add your own sorting option displayed in the drop down list. For this, add the following code to functions.php.


install-and-present-product-wagons-following-statutory-format-format


Save the file, reload the page to see the Woo WooCraft Commercial Product Sorting option at the drop down list.


install-and-display-product-wagons-following-the-policy-meta


Conclusion


For this article, I discussed how to organize and display WooCommerce products by custom fields as well as post meta. The example is very simple to implement and is extended to include any number of sorting options. If you have any questions, leave a comment below.


0 Comments

seo marketing wordpress seo seo hosting seo and marketing word press seo wordpress and seo wordpress marketing hosting seo seo press pro market seo seo & marketing seo e marketing e marketing seo seo pro wordpress marketing & seo seo di wordpress wordpress seo host hosting and seo wordpress hosting seo wordpress seo wordpress wordpress for marketing seo press wordpress marketing for seo
×