WooCommerce AJAX cross domain add to cart

If you have enabled the CORS policy headers then you can directly add a product via link given below; Site-url.com/?add-to-cart=PRO-ID&variation_id=ATTR-ID&quantity=1&attribute_YOUR-ATTR-NAME=ATTR-VALUE Trigger this url for an ajax / windows location on an action in your javascript.

WooCommerce Orders pagination

OK. As far as I researched the WooCommerce provides default pagination for orders in My Account page. See this GitHub issue here. And also see, there is a hook declared at my-orders.php in your code called woocommerce_before_account_orders_pagination by doing <?php do_action( ‘woocommerce_before_account_orders_pagination’ ); ?> So WooCommerce provides default pagination. You better use it. May be … Read more

How to get sub items of parent menu item?

As a workaround I have this temporary solution: $the_menu = wp_get_nav_menu_object(‘Some Menu’); $the_menu_items = wp_get_nav_menu_items($the_menu); $category_products = []; foreach ($the_menu_items as $index => $menu_category) { if ($menu_category->object_id == $category->term_id ) { $category_submenu = $menu_category; } } foreach ($the_menu_items as $index => $menu_product) { if ($menu_product->type_label == ‘Product’ && $menu_product->menu_item_parent == $category_submenu->ID ) { $category_products[] = … Read more

Woocommerce – Checkout error message

you can try it for address not required . add_filter( ‘woocommerce_billing_fields’, ‘wc_optional_billing_fields’, 10, 1 ); function wc_optional_billing_fields( $address_fields ) { $address_fields[‘billing_address_1’][‘required’] = false; $address_fields[‘billing_address_2’][‘required’] = false; return $address_fields; }