3
votes
How to unhook a function in Woocommerce Template?
remove_action requires that the second parameter is the name of the function/callable that was added, and the priority must match what was added.
The official documentation says its parameters are:
...
3
votes
Accepted
How to unhook a function in Woocommerce Template?
You need to unhook the function from that action specifically:
remove_action( 'woocommerce_review_before_comment_meta',
'woocommerce_review_display_rating', 10 );
(e.g. look for the ...
2
votes
how customise Woocommerce style of custom theme
You can add your own css based on the classes created by WooCommerce.
If you are working in a (child)theme, you can add a stylesheet by adding this code in functions.php:
/**
* Enqueue your own ...
2
votes
Accepted
paypal not showing on woocommerce payments
Paypal standard is now hidden for new installs, possible to read about it in https://developer.woocommerce.com/2021/07/12/developer-advisory-paypal-standard-will-be-hidden-on-new-installs/
for those ...
2
votes
Accepted
Woocommerce: Complex query in pre_get_posts
When I have complex querie to do,
I often use a prequery to get the good post_ids.
Then I pass this list of post_ids to my main query via the post__in parameter of WP_Query.
$meta_key = 'RepeaterName_%...
2
votes
Accepted
Using a filter to change a path
Create the template you want to use, say wc-vp-table-rows.php, put it in your theme, and add the following to your functions.php:
add_filter(
'wcvendors_pro_table_display_rows_path',
fn() =&...
2
votes
600k of option_name "c_facebook_background_product_sync_job"
Use phpmyadmin to make a backup of the wp_options table.
Then run the same command again, but replace SELECT COUNT(*) with DELETE
2
votes
Accepted
Categories are not listing their respective products
Normally, while creating a store, you'd go with the third choice, items and categories/subcategories. This means that users can either choose products directly from the main page or refine their ...
1
vote
Add item to the woocommerce dashboard menu from a plugin
try this code. Paste in to function.php
add_action('admin_menu', 'custom_page');
function custom_page() {
add_submenu_page( 'woocommerce', 'Name of page', 'Name of item', 'manage_options', 'custom-...
1
vote
Accepted
WooCommerce single products images doesn't zoom on hover and doesn't change clicking on gallery
my solution works for who makes a theme from zero (not using WordPress ready themes)
make a Backup from your WordPress theme
go to wp-content/plugins/woocommerce and find and copy a directory which ...
1
vote
Add html link in functions.php files of the theme
You are missing a closing tag for the opening link (<a>) tag, try:
function filter_woocommerce_checkout_must_be_logged_in_message( $message ) {
$message = '<span>You must be <a href=...
1
vote
Order with custom order status disappeared once the page is refreshed
My bad, I was using add_filter() instead of add_action() in 'init' hook.
The following link is the perfect solution for adding custom order status and email notification. My Woocommerce version is ...
1
vote
WooCommerce Product detail page: Add content under thumbnails
In woocommerce/templates/content-single-product.php you can see that woocommerce_show_product_images is hoooked with a priority of 20.
if you want your custom function to render below the images, but ...
1
vote
Accepted
require_once() if a product in woocommerce contains a tag
has_term() is a template function therefore it does not work if you use it straight in functions.php which is loaded well before knowing if the current object is a product page.
So if you use it in ...
1
vote
Accepted
How to change woocommerce checkout privacy policy, terms and condition text
After some digging in WooCommerce github and WordPress github I can say that there isn't a filter, in WooCommerce, to change that specific text.
What you can do is hook into pre_kses, because that ...
1
vote
Customize WooCommerce Add To Cart Form Name
Yes, you can do it using the override woocommerce template.
Guide to override template - https://zemez.io/support/wordpress/how-to/override-woocommerce-template-files/
Once you copy templates/single-...
1
vote
Woocommerce Email show HTML source code
The problem was indeed in the settings from my SMTP host (Elastic Email). They also had a update but the 'Auto' function doesn't work properly. You have to change it to html/text and Woocommerce ...
1
vote
How do I make a diagonal strikethrough on wordpress?
The html structure for WooCommerce original price, if sale price exists is this.
<del>
<span class="woocommerce-Price-amount amount">
<bdi>
<span ...
1
vote
Accepted
Can't filter out variable products in sale from wp_get_products loop (or shortcode)
Ok, after some digging around I've finally found the answer I was looking for. Turns out there is a function called wc_get_product_ids_on_sale() you can use to exclude those ID's from wc_get_products.
...
1
vote
Add SKU in Product Title
In the above code. You are adding the SKU code on all the product on every post saved. Instead of all post you should just update only product which you are updating. And send you should check if SKU ...
1
vote
How to add product filter dropdown in woo commerce order page?
Here is solution for above questions
// Custom function to get the product names, that appear in the existing orders
function get_product_names() {
global $wpdb;
return $wpdb->get_col("
...
1
vote
Accepted
How to optimize update_post_meta?
To achieve what you want you're better creating an associative array and then walking over it with a foreach loop as shown below :
$data = array(
'_shipping_first_name' => $order->...
1
vote
Woocommerce. Max weight per order based on shipping class
This will do it:
add_action('woocommerce_check_cart_items','check_cart_weight');
add_action('woocommerce_checkout_process', 'check_cart_weight' );
function check_cart_weight()
{
$cart = WC()-&...
1
vote
Remove WooCommerce block styles
The dequeue handle is incorrect
it should be wp_dequeue_style('wc-block-style'); and not wp_dequeue_style('wc-block-style-css');
A bit confusing at first i agree, every js and css that was enqued via ...
1
vote
WooCommerce - Add product with image via REST API
instead of 'sslverify'
'verify_ssl' => false,
1
vote
Accepted
Absolute Image URL in srcset is appended to the upload dir
I guess you worked around that issue - still I stumbled over your post having the same issue. I was able to work around by applying a bugfix from woozone itself - in your wordpress solution with ...
1
vote
Accepted
Get product attribute for Simple product in WooCommerce
Building on Loic's answer for an attribute of pa_manufacturer:
if ( get_post_type( $post ) === 'product' && ! is_a($product, 'WC_Product') ) {
$product = wc_get_product( get_the_id() ); // ...
1
vote
Getting categories id for all products in cart
The answer from @sally works great, as long as your products are Simple products.
If your product uses a variation, then the above code no longer works as the $cart_item['data'] does not return the ...
1
vote
Add custom body tag if product is out of stock
I have updated the code from @Adnrea Somovigo and customize it, to display body classes, based on stock_status, not on stock_quantity. So this should work also for in-stock, on-backorder and out-of-...
1
vote
Are there any hook or filter when refund is done through admin -woocommerce
My answer is for emails or when refunds are done through the payment gateway but it might help someone coming across this. So in addition to Tech Dog's answer You can use a few other hooks ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
woocommerce-offtopic × 3900php × 551
plugins × 416
functions × 228
plugin-development × 214
categories × 188
hooks × 167
customization × 158
wp-query × 129
filters × 115
custom-field × 108
ajax × 78
custom-taxonomy × 70
javascript × 69
theme-development × 68
custom-post-types × 67
email × 67
css × 66
rest-api × 66
loop × 65
actions × 64
jquery × 58
order × 58
templates × 57
search × 57