crslz
Forum Replies Created
-
Forum: Plugins
In reply to: [WooCommerce] WooCommerce remove categories from shop pageHi,
Can you take a look at the following file?
yourtheme/woocommerce/loop/add-to-cart.php.
I suppose you can find the output of <div class = “products-page-cats”> … there.
So if you want to remove the categories you can adjust the html output.
If you don’t understand, can you post the contents of that file here?
Forum: Plugins
In reply to: [WooCommerce] How to make Customer Billing Phone Number Unique in WordPressForum: Plugins
In reply to: [WooCommerce] Restrict Access with Post CodeHi,
When validating on the post code, you can add an array with allowed post codes, and then adjust the validation accordingly
https://www.php.net/manual/en/function.in-array.php
function my_restrict_access() { $category = get_queried_object(); if ( $category ) { $category_id = isset( $category->term_id ); // uncomment line below for debug purposes, this will show you the category id on the current category page // echo $category_id; if( $category_id == 15 ) { if ( !is_user_logged_in() ) { wp_redirect( '/' ); exit; } else { global $woocommerce; $customer = new WC_Customer(); $customer_postcode = $woocommerce->customer->get_billing_postcode(); // uncomment line below for debug purposes, this will show you the postcode on the current page // echo $customer_postcode; $allowed_post_code = array(3610, 3626, 3650); if ( !in_array($customer_postcode, $allowed_post_code) ) { wp_redirect( '/' ); exit; } } } } } add_action( 'template_redirect', 'my_restrict_access');
Regards
Forum: Plugins
In reply to: [WooCommerce] How to make Customer Billing Phone Number Unique in WordPressI know what your intention is, my question is how you added that phone field, because the validation will depend on it
Forum: Plugins
In reply to: [WooCommerce] Terms and conditions checkbox missingHi,
If I add a product to the shopping cart and checkout I see this?
Forum: Plugins
In reply to: [WooCommerce] How to make Customer Billing Phone Number Unique in WordPressHi,
Do I understand correctly that you want to validate the telephone field when registering? normally there is no telephone field there? how did you add this? because this can determine the method of validation.
P.s. the woocommerce_register_form hook is to add fields, woocommerce_register_post can then be used to validate.
Forum: Plugins
In reply to: [WooCommerce] guides on choosing product photoHi,
you can add the photo to the product as a download
Forum: Plugins
In reply to: [WooCommerce] Restrict Access with Post CodeYes you can. I also assume that you want to restrict access for users who are not logged in (guests) whose zip code is unknown for those pages?
function my_restrict_access() { $category = get_queried_object(); if ( $category ) { $category_id = isset( $category->term_id ); // uncomment line below for debug purposes, this will show you the category id on the current category page // echo $category_id; if( $category_id == 15 ) { if ( !is_user_logged_in() ) { wp_redirect( '/' ); exit; } else { global $woocommerce; $customer = new WC_Customer(); $customer_postcode = $woocommerce->customer->get_billing_postcode(); // uncomment line below for debug purposes, this will show you the postcode on the current page // echo $customer_postcode; if ( $customer_postcode == 9000 ) { wp_redirect( '/' ); exit; } } } } } add_action( 'template_redirect', 'my_restrict_access');
No, compare it with the price of a product that you are going to change after this product has been purchased several times.
Should the price of this product in those earlier orders also adjust, then the customer would have to pay afterwards.
The download is part of the product, and the product is part of the order.
So changing the product afterwards will not affect that product in previous orders
@mohitmishra I was talking about this one. the last code you added will indeed overwrite this.
Only then do you have the code from the original file (woocommerce folder). Then the file from the template folder (the overridden) and this hook that will adjust this again.
@mohitmishra your hook will only works to change text that is already present, not to change an icon that has been added from a template file with other html formatting.
@arwah12: you say: “I just deleted all the code files.” You only had to delete 1 file? the ‘add-to-cart.php’ file from your theme folder.
@puckett20: it is indeed true that this can be slightly different for each theme. In the theme folder, the original file from the woocommerce folder is overwritten with adjustments. That is why I recommend deleting this file so that the default file is loaded from the woocommerce plugin. Then you should see the button with ‘add to cart’ text. But as I mentioned earlier, there are still css adjustments needed to layout to get this fully on track, and that will be different for each theme.
Forum: Plugins
In reply to: [WooCommerce] WooCommerce Is GoneI mean next file
yourtheme/woocommerce/loop/add-to-cart.php.
In the plugin of woocommerce there are default theme files, if you use these files in your theme (a copy with adjustments) they will override the default files of the woocommerce plugin.
So if you deleted the file from your theme, the default file (from woocommerce plugin) will be loaded anyway
NOTE: before deleting, make a copy of this file on your PC as a backup file !!
Forum: Plugins
In reply to: [WooCommerce] How I can add custom content after product thumbnail galleryHi,
As you can see here there are several hooks to add extras to the single product page.
However, it may be that the theme you use has adjusted this so that you have to figure out which hook is most suitable for this extra functionality.
Additional question: how do you want to add the content yourself? is this the same for every page? then you can safely do this via hardcode in the hook.
However, if you want different content per product, then when creating the product you will have to provide an extra field where you can then add the content.
Regards