Posts

Showing posts from November, 2019

WooCommerce Shortcodes

Image
WooCommerce shortcodes can be used to insert content inside posts and pages. Here are a list of the WooCommerce shortcodes with examples to use. What are shortcodes? [woocommerce_cart] – shows the cart page [woocommerce_checkout] – shows the checkout page [woocommerce_my_account] – shows the user account page [woocommerce_order_tracking] – shows the order tracking form [add_to_cart id=”99″ style=”border-right:1px solid #ccc”] – Show the price and add to cart button of a single product by ID. [add_to_cart_url id=”99″] – Echo the URL on the add to cart button of a single product by ID. [products tag=”hoodie”] – Show Only Products With tag “hoodie” [product_page id=”99″] – Show a full single product page by ID [product_page sku=”FOO”] – Show a full single product page by SKU [products id=”7, 9, 22, 15, 22, 67″ orderby=”title” order=”desc”] – Shows a set of products by ids or skus. [products limit=”4″ columns=”4″ orderby=”id” order=”DESC” visibility=”visible”] – Display the new...

Create WooCommerce Custom Accounts Page

Image
In this post I am going to show you how to create WooCommerce custom accounts page. We will create a new accounts tab and a page linked to it. Create New Account Tab We will create a new tab “CI Custom Endpoint” and assigned it to the items array. Our custom tab menu function will be hooked to woocommerce_account_menu_items. The logout menu tab is passed to unset() function because we want our Custom Tab before it. Later again Logout tab is added to the items[] array to display it in the end . Flush Rewrite Rules We need to register a new endpoint in WordPress using the add_rewrite_endpoint() function. Also register it using the query_vars filter. Endpoints are an extra part in the site URL that detect and show different content of page. Custom Accounts Page In last step the ci_custom_endpoint_content() function includes custom page and is hooked to endpoint. The code within this function will display tabs data. You can add code directly to function or can add a custom page. The page ...