MyListing Club

Combine Billing Address and Payment Methods for WooCommerce

Building better MyListing websites. One code snippet at a time.

Overview

The Combine Billing Address and Payment Methods for WooCommerce code snippet allows for greater flexibility within a MyListing website.

Out of the box, WooCommerce creates separate endpoints (i.e. pages) for each of these elements, which may not be desirable for website owners.

Implementation

  1. Grab the code snippet.
  2. Follow the provided instructions.
  3. Save your changes.
				
					//// INSTRUCTIONS: 
//// Copy and paste the code snippet below into the child theme's functions.php file.
//// You can edit the functions.php file from your WordPress dashboard (Appearance > Theme Editor) or via FTP.

--------------------------- CODE SNIPPET IS BELOW THIS LINE --------------------------- 

// WOOCOMMERCE - COMBINE BILLING ADDRESS AND PAYMENT METHODS
add_filter(
  "woocommerce_account_menu_items",
  function ($items) {
    unset($items["edit-address"]);
    unset($items["payment-methods"]);
    return $items;
  },
  999
);

add_action(
  "woocommerce_account_edit-account_endpoint",
  "woocommerce_account_payment_methods"
);
add_action(
  "woocommerce_account_edit-account_endpoint",
  "woocommerce_account_edit_address"
);