Commit 7acddbdf26 for woocommerce

commit 7acddbdf26db0e38263b469250120fc6f28aef4b
Author: Brian Coords <bacoords@gmail.com>
Date:   Mon Jun 16 08:58:43 2025 -0700

    Cleans up some outdated backslashes and code formatting in docs (#58818)

    cleans up some outdated backslashes and code formatting in docs

diff --git a/docs/best-practices/data-management/adding-a-custom-field-to-variable-products.md b/docs/best-practices/data-management/adding-a-custom-field-to-variable-products.md
index 84e9906e10..06b457a306 100644
--- a/docs/best-practices/data-management/adding-a-custom-field-to-variable-products.md
+++ b/docs/best-practices/data-management/adding-a-custom-field-to-variable-products.md
@@ -58,7 +58,7 @@ For our Woo extension, we'll be appending our field right at the end with `wooco

 ## Creating our class

-Let's get started with creating a new class which will hold the code for the field. Add a new file with the name `class-product-fields.php` to the `/includes/admin/` folder. Within the class, we add our namespace, an abort if anyone tries to call the file directly and a \_\_construct method which calls the `hooks()` method:
+Let's get started with creating a new class which will hold the code for the field. Add a new file with the name `class-product-fields.php` to the `/includes/admin/` folder. Within the class, we add our namespace, an abort if anyone tries to call the file directly and a `__construct` method which calls the `hooks()` method:

 ```php
 <?php
@@ -77,7 +77,7 @@ class ProductFields {
 }
 ```

-Then in Terminal we run `composer dump-autoload -o` to regenerate the class map. Once that's done, we add the class to our `setup.php` \_\_construct() function like so:
+Then in Terminal we run `composer dump-autoload -o` to regenerate the class map. Once that's done, we add the class to our `setup.php` `__construct()` function like so:

 ```php
 class Setup {
@@ -86,6 +86,7 @@ class Setup {

 		new ProductFields();
     }
+}
 ```

 ## Adding the custom field
@@ -144,7 +145,7 @@ If we add data and save the product, then the new meta data is inserted into the

 At this point you have a working extension that saves a custom field for a product as product meta.
 Showing the field in the store
-If we want to display the new field in our store, then we can do this with the `get_meta()` method of the Woo product class: `$product->get_meta( '\_new_stock_information' )`
+If we want to display the new field in our store, then we can do this with the `get_meta()` method of the Woo product class: `$product->get_meta( '_new_stock_information' )`

 Let's get started by creating a new file /includes/class-product.php. You may have noticed that this is outside the `/admin/` folder as this code will run in the front. So when we set up the class, we also adjust the namespace accordingly:

@@ -229,10 +230,10 @@ public function add_variation_field( $loop, $variation_data, $variation ) {

 	woocommerce_wp_text_input(
 		array(
-			'id' => '\_new_stock_information' . '[' . $loop . ']',
-			'label' => \_\_( 'New Stock Information', 'woo_product_field' ),
+			'id' => '_new_stock_information' . '[' . $loop . ']',
+			'label' => __( 'New Stock Information', 'woo_product_field' ),
 			'wrapper_class' => 'form-row form-row-full',
-			'value' => $variation_product->get_meta( '\_new_stock_information' )
+			'value' => $variation_product->get_meta( '_new_stock_information' )
 		)
 	);
 }
diff --git a/docs/best-practices/security/security-best-practices.md b/docs/best-practices/security/security-best-practices.md
index 07bf146ddc..43804bb4ef 100644
--- a/docs/best-practices/security/security-best-practices.md
+++ b/docs/best-practices/security/security-best-practices.md
@@ -81,7 +81,7 @@ Hardening your WordPress installation can help protect your WooCommerce store fr

 1. Use strong, unique passwords for all user accounts.
 2. Limit login attempts and enable two-factor authentication (2FA) to protect against brute-force attacks.
-3. Change the default "wp\_" table prefix in your WordPress database.
+3. Change the default `wp_` table prefix in your WordPress database.
 4. Disable XML-RPC and REST API access when not needed.
 5. Keep file permissions secure and restrict access to sensitive files and directories.

diff --git a/docs/code-snippets/customising-checkout-fields.md b/docs/code-snippets/customising-checkout-fields.md
index 57403ea773..c0b0e4403d 100644
--- a/docs/code-snippets/customising-checkout-fields.md
+++ b/docs/code-snippets/customising-checkout-fields.md
@@ -305,7 +305,7 @@ function my_custom_checkout_field_display_admin_order_meta($order){

 It's alive!

-What do we do with the new field? Nothing. Because we defined the field in the `checkout_fields` array, the field is automatically processed and saved to the order post meta (in this case, \_shipping_phone). If you want to add validation rules, see the checkout class where there are additional hooks you can use.
+What do we do with the new field? Nothing. Because we defined the field in the `checkout_fields` array, the field is automatically processed and saved to the order post meta (in this case, `_shipping_phone`). If you want to add validation rules, see the checkout class where there are additional hooks you can use.

 ### Adding a Custom Special Field

diff --git a/docs/code-snippets/link-to-logged-data.md b/docs/code-snippets/link-to-logged-data.md
index 96eecb3839..b8cdfd5b30 100644
--- a/docs/code-snippets/link-to-logged-data.md
+++ b/docs/code-snippets/link-to-logged-data.md
@@ -12,8 +12,8 @@ sidebar_label: Add link to logged data
 use Automattic\WooCommerce\Utilities\LoggingUtil;

 // Define the label and description for the logging option
-$label = \_\_( 'Enable logging', 'your-textdomain-here' );
-$description = \_\_( 'Log events and errors to help with troubleshooting.', 'your-textdomain-here' );
+$label = __( 'Enable logging', 'your-textdomain-here' );
+$description = __( 'Log events and errors to help with troubleshooting.', 'your-textdomain-here' );

 // Check if WooCommerce's logging feature is enabled.
 if ( LoggingUtil::logging_is_enabled() ) {
@@ -27,14 +27,14 @@ if ( LoggingUtil::logging_is_enabled() ) {
     );

     $label .= ' | ' . sprintf(
-        \_\_( '<a href="%s">View logs</a>', 'your-textdomain-here' ),
+        __( '<a href="%s">View logs</a>', 'your-textdomain-here' ),
         $logs_url
     );
 }

 // Add the logging option to the form fields.
-$form_fields\['yourpluginslug_debug'\] = array(
-  'title'       => \_\_( 'Debugging', 'your-textdomain-here' ),
+$form_fields['yourpluginslug_debug'] = array(
+  'title'       => __( 'Debugging', 'your-textdomain-here' ),
   'label'       => $label,
   'description' => $description,
   'type'        => 'checkbox',
diff --git a/docs/features/payments/payment-gateway-api.md b/docs/features/payments/payment-gateway-api.md
index 01cf50677d..781c4a632d 100644
--- a/docs/features/payments/payment-gateway-api.md
+++ b/docs/features/payments/payment-gateway-api.md
@@ -33,7 +33,7 @@ It is also important that your gateway class extends the WooCommerce base gatewa

 ```php
 function init_your_gateway_class() {
-class WC_Gateway_Your_Gateway extends WC_Payment_Gateway {}
+    class WC_Gateway_Your_Gateway extends WC_Payment_Gateway {}
 }
 ```

@@ -43,8 +43,8 @@ As well as defining your class, you need to also tell WooCommerce (WC) that it e

 ```php
 function add_your_gateway_class( $methods ) {
-$methods\[\] = 'WC_Gateway_Your_Gateway';
-return $methods;
+    $methods[] = 'WC_Gateway_Your_Gateway';
+    return $methods;
 }
 ```

@@ -56,7 +56,7 @@ add_filter( 'woocommerce_payment_gateways', 'add_your_gateway_class' );

 Most methods are inherited from the WC_Payment_Gateway class, but some are required in your custom gateway.

-#### \_\_construct()
+#### __construct()

 Within your constructor, you should define the following variables:

@@ -69,7 +69,7 @@ Within your constructor, you should define the following variables:
 Your constructor should also define and load settings fields:

 ```php
-$this->init\_form\_fields();
+$this->init_form_fields();
 $this->init_settings();
 ```

@@ -84,7 +84,7 @@ $this->title = $this->get_option( 'title' );
 Finally, you need to add a save hook for your settings:

 ```php
-add_action( 'woocommerce_update_options_payment_gateways\_' . $this->id, array( $this, 'process_admin_options' ) );
+add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) );
 ```

 #### init_form_fields()
@@ -95,24 +95,24 @@ A basic set of settings for your gateway would consist of _enabled_, _title_ and

 ```php
 $this->form_fields = array(
-'enabled' => array(
-'title' => \_\_( 'Enable/Disable', 'woocommerce' ),
-'type' => 'checkbox',
-'label' => \_\_( 'Enable Cheque Payment', 'woocommerce' ),
-'default' => 'yes'
-),
-'title' => array(
-'title' => \_\_( 'Title', 'woocommerce' ),
-'type' => 'text',
-'description' => \_\_( 'This controls the title which the user sees during checkout.', 'woocommerce' ),
-'default' => \_\_( 'Cheque Payment', 'woocommerce' ),
-'desc_tip' => true,
-),
-'description' => array(
-'title' => \_\_( 'Customer Message', 'woocommerce' ),
-'type' => 'textarea',
-'default' => ''
-)
+    'enabled' => array(
+        'title' => __( 'Enable/Disable', 'woocommerce' ),
+        'type' => 'checkbox',
+        'label' => __( 'Enable Cheque Payment', 'woocommerce' ),
+        'default' => 'yes'
+    ),
+    'title' => array(
+        'title' => __( 'Title', 'woocommerce' ),
+        'type' => 'text',
+        'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce' ),
+        'default' => __( 'Cheque Payment', 'woocommerce' ),
+        'desc_tip' => true,
+    ),
+    'description' => array(
+        'title' => __( 'Customer Message', 'woocommerce' ),
+        'type' => 'textarea',
+        'default' => ''
+    )
 );
 ```

@@ -128,15 +128,15 @@ global $woocommerce;
 $order = new WC_Order( $order_id );

     // Mark as on-hold (we're awaiting the cheque)
-    $order->update\_status('on-hold', \_\_( 'Awaiting cheque payment', 'woocommerce' ));
+    $order->update_status('on-hold', __( 'Awaiting cheque payment', 'woocommerce' ));

     // Remove cart
-    $woocommerce->cart->empty\_cart();
+    $woocommerce->cart->empty_cart();

     // Return thankyou redirect
     return array(
         'result' => 'success',
-        'redirect' => $this->get\_return\_url( $order )
+        'redirect' => $this->get_return_url( $order )
     );

 }
@@ -173,14 +173,14 @@ Stock levels are updated via actions (`woocommerce_payment_complete` and in tran
 Updating the order status can be done using functions in the order class. You should only do this if the order status is not processing (in which case you should use payment_complete()). An example of updating to a custom status would be:

 ```php
-$order = new WC\_Order( $order\_id );
-$order->update_status('on-hold', \_\_('Awaiting cheque payment', 'woothemes'));
+$order = new WC_Order( $order_id );
+$order->update_status('on-hold', __('Awaiting cheque payment', 'woothemes'));
 ```

 The above example updates the status to On-Hold and adds a note informing the owner that it is awaiting a Cheque. You can add notes without updating the order status; this is used for adding a debug message:

 ```php
-$order->add_order_note( \_\_('IPN payment completed', 'woothemes') );
+$order->add_order_note( __('IPN payment completed', 'woothemes') );
 ```

 ### Order Status Best Practice
@@ -208,7 +208,7 @@ Finally, you need to add payment code inside your `process_payment( $order_id )`
 If payment fails, you should output an error and return the failure array:

 ```php
-wc_add_notice( \_\_('Payment error:', 'woothemes') . $error_message, 'error' );
+wc_add_notice( __('Payment error:', 'woothemes') . $error_message, 'error' );
 return array(
     'result'   => 'failure',
 );
@@ -224,8 +224,8 @@ $order->payment_complete();
 ```php
 // Return thank you page redirect
 return array(
-'result' => 'success',
-'redirect' => $this->get_return_url( $order )
+    'result' => 'success',
+    'redirect' => $this->get_return_url( $order )
 );
 ```

diff --git a/docs/features/payments/payment-token-api.md b/docs/features/payments/payment-token-api.md
index 93e0e41d78..b5b864064a 100644
--- a/docs/features/payments/payment-token-api.md
+++ b/docs/features/payments/payment-token-api.md
@@ -173,7 +173,7 @@ Finally, return true if we make it to the end of the `validate()` method.
 }
 ```

-#### Step 2: Provide get\_ And set\_ Methods For Extra Data
+#### Step 2: Provide `get_` And `set_` Methods For Extra Data

 You can now add your own methods for each piece of data you would like to expose. Handy functions are provided to you to make storing and retrieving data easy. All data is stored in a meta table so you do not need to make your own table or add new fields to an existing one.