You need to modify the values of these below variables of your code-
// HERE define your shipping class to find
$class = 92;
// HERE define the shipping method to hide
$method_key_id = 'flat_rate:7';
Though the author of source answer clarified how to get these above things in the answer, here I’m putting these again.
Finding the shipping class ID.
1) In the database under wp_terms
table:
Search for a term name or a term slug and you will get the term ID (the shipping class ID).
2) On Woocommerce shipping settings editing a “Flat rate”, with your browser html inspector tool, inspect a shipping Class rate field like:
In the imput name attribute you have woocommerce_flat_rate_class_cost_64
. So 64 is the ID for the shipping class.
Get the shipping method rate ID:
To get the related shipping methods rate IDs, something like
flat_rate:12
, inspect with your browser code inspector each related radio button attributename
like:
Related Posts:
- How to get current product category ID in product archive page
- WooCommerce prices location in DB
- WP/WooCommerce REST API cart/checkout/order [closed]
- Hide Add to Cart Button
- How to modify “[Product] has been added to your cart” in WooCommerce?
- Why do Woocommerce templates use hooks rather than get_template_part
- Display WooCommerce only in stock sizes product attribute on shop page
- Remove “Choose An Option” on Product Variation & Auto Select Instead
- check if current url/page equals checkout page [closed]
- Mini cart in header using divi is not getting updated on changing the cart items count:
- How to stop a Gutenberg Block from firing multiple GET Requests?
- Woocommerce Product Price Inserted programmatically doesn’t get displayed In Single Product Page
- How to Order by random on a SQL query
- Move add to cart in Woocommerce
- Hide “Delete Note” link in Order Notes Panel
- Exclude products with a stock lower than the low stock threshold from the shop loop [closed]
- Remove Order List Row Link in WooCommerce Admin?
- How do I hide out of stock products from homepage but not from catalog?
- wp_customize – detect post type to show/hide customizer options
- WooCommerce – Display nested list of all subcategories on archive-product.php
- Woocommerce Porto Theme Hide Selected Categroy for Breadcrumbs
- How can I custom order the product display?
- WordPress plugin cloak link [closed]
- Woocommerce REST API – updating an order changes custom tax calculations
- How to list all WC products by their attributes values?
- Showing the WordPress standard text area on a Woocommerce Single Product Page?
- Woocommerce custom search
- WordPress WooCommerce: How to allow only specified customers to pay by check? [closed]
- Make a Read More toggle in the_content on single-product in Woocoomerce
- WooCommerce Base Page Featured Image Custom Theme
- WordPress Comment Box on woocommerce product page [closed]
- Remove Bulk Action For non admin user
- Add max-value to hooked quantity selector in woocommerce [closed]
- Can’t remove woocommerce sidebar
- Woocommerce Slow Queries
- How to display the percentage of the applied tax in woocommerce [closed]
- Disabling shopping basket in WooCommerce [closed]
- Single product page doesn’t display price
- Should I use docker in wordpress production?
- Dynamic Product Variation in WooCommerce
- Get decimal from product price with Mysql
- can’t get the product id in single woocommerce page
- Php echo woocommerce price
- Different files for order details
- Multiple Schema.org markups on a single product page
- Woocommerce – Adding row to cart table
- Hide a product with a certain tag from product-category
- Custom rewrite for product variation not working
- Block Disposable Emails on Woocommerce Registration
- Can’t Change WooCommerce Default Language to Spanish (Mexico)
- Adding of custom cart item data via Ajax Add to Cart
- Woocommerce – Display stock quantity per variation
- WooCommerce get_author_posts_url() – Author URL redirecting to shop base
- Error message if user is buying less than 200 euros of a given product [closed]
- WooCommerce show a variation both in check boxes and in a list
- Woocommerce – How to mix products and posts on a landing page?
- Disable woocommerce product search plugin’s autocomplete [closed]
- How to Remove Active css from woocommerce variation?
- How can i get the code of Shop Page Woocommerce?
- “Products” Title changed
- Password protected selling / selling one product at the time
- Add shortcode to show woocommerce shipping class name on product template
- wp_login overriding user meta data
- pass a woocommerce product name to contact form7?
- Custom Tab in Coupons causes “the link you followed has expired” error
- Search doesn’t return anything
- How to override WooCommerce template files
- Woocommerce List categories with Image thumbnail
- How to add (and change the font of) the short product description to order page and customer’s new order e-mail [closed]
- Using built-in validation pop-up for custom fields
- How to add woocommerce product price filter widget to other page
- Remove Stripe Woocommerce Credit Card Icons (and replace with image)
- How to add external product url to woocommerce from a metadata by function.php
- Unable to call woocommerce hook in my custom php file
- How to apply a custom coupon to a WooCommerce Subscription recurring amount?
- How to send an automatic email to a custom field in Woocommerce order meta 2 weeks after a product is bought
- Woocommerce cart table too wide [closed]
- Make Woocommerce breadcrumbs show up using functions.php file
- Alter the cost of products using phpmyadmin sql query
- How does one allow any customer to process any order in store on woocommerce?
- WooCommerce CSV Image URL Creates Additional Images in Media Folder
- Custom changes performed on WP + WooCom site on maintenance subdomain. How to perform a migration to a main domain?
- Woocommerce Child Category Permalink Structure Change
- Allow customer to choose an optional free/paid product to add to their order (and reduce stock reduced & record sale)
- How to restrict type/size of file uploads in any plugin?
- In woocommerce some products have empty options, but how to check this
- Stop the “upload file size” error from printing [closed]
- How to disable the “Upgrade or Downgrade” button in “My account” of WooCommerce Subscriptions
- WooCommerce – Inconsistent Indexing of Orders
- Woocommerce Add to Cart function
- WooCommerce – doesn’t show product when using woocommerce.php [closed]
- How to show woocommerce login / registration form in modal
- url rewrite doesn’t load woocommerce product
- Woocommerce – display all sold out products
- Woocommerce how to show most selling products by category
- AffiliateWP not calculating multiple quantities when using affwp_calc_referral_amount filter
- Hide a shipping method if cart total is higher than an amount
- WordPress pointing animated GIF images with wrong file name upon upload (GIFs animation not working)
- How to update all products with same SKU prefixes when updating stock with CSV?
- What is the best and cheapest way to generate dashboards about conversions data and store users? [closed]