WordPress Developer Ukraine, Kyiv
WooCommerce wc_get_product(): Read Product Data, Pricing, Stock, and Variations with WC_Product

WooCommerce wc_get_product(): Read Product Data, Pricing, Stock, and Var ...

wc_get_product(): read and change WooCommerce product data A WooCommerce product is a post, but its data (prices, stock, SKU, dimensions, gallery) is managed by WooCommerce’s product classes. Since WooCommerce 3.0 the right way to read and change it is the product object returned by wc_get_product(), with getters like get_price() and setters plus save(). Reading post…
WordPress Term Meta: add_term_meta, get_term_meta, and Custom Fields for Categories

WordPress Term Meta: add_term_meta, get_term_meta, and Custom Fields for ...

Term meta: custom fields for categories, tags and custom taxonomies Since WordPress 4.4 terms have their own meta table, and add_term_meta(), get_term_meta(), update_term_meta() and delete_term_meta() work like their post counterparts. Before that, plugins kept term data in options with keys like category_12_image. Term meta is the place for data that belongs to the term itself:…
WooCommerce: Add to Cart Without Page Reload Using AJAX

WooCommerce: Add to Cart Without Page Reload Using AJAX

WooCommerce: add to cart without page reload using AJAX WooCommerce can add products to the cart without reloading the page, but a custom cart link in the header doesn’t know about it: the item count and total stay the same until the next page load. The woocommerce_add_to_cart_fragments filter fixes that by refreshing your cart markup…
WooCommerce: Add Custom Fields to Product Variations

WooCommerce: Add Custom Fields to Product Variations

WooCommerce: add a custom field to product variations Each variation of a variable product (a size, a colour) has its own price, stock and SKU. Sometimes it also needs its own text: a “Best value” badge on the large size, a delivery note for one colour. WooCommerce has hooks to add such a field to…