How to hide payment methods by product or category in WooCommerce

By default WooCommerce will show all the active payment methods on your final purchase page but that's not always the case

Imagine, for example, that in some product you do not want to be able to use the bank transfer, or Paypal, or cash on delivery .

Situations can be very varied, from a immediate delivery product where the bank transfer or simply virtual products where it does not make any logic to show the payment on delivery or cash on delivery, right?


Well, WooCommerce allows us to decide many things in your settings or in the details of the products, but this does not. Let's take the reins .

Hide payment methods by product with code (FREE)

If you know what products you want hide some payment gateways nothing better than use a bit of code. Just add it to the file functions . php of your active theme or to your customizations plugin or mu-plugin .

In the previous example you should only take into account the variables to be modified. On the one hand there is the array $ prodids which is where you put the list of IDs of your products for which you want to hide payment gateways, in the example IDs 15 and 30. [19659003] To know the ID of a product you just have to go through the product administration page, there you have it clearly, when you hover over any product.

Another parameter to take into account is the payment gateway (s) to be hidden, in the example Paypal (paypal) and cash on delivery (cod). If you want to add or remove payment gateways to hide just follow the example, can also hide other gateways like bank transfer (bacs), Stripe (stripe) or others, depends on your goal.

To know the ID of the payment gateways just stop by the administration of your store in WooCommerce -> Settings -> Finish [19659010] purchase and there you have them.

Hide payment methods by category with code (FREE)

You can also decide which payment gateways to hide , not by product but by complete category . You can do it with this other code.

Hide payment methods by category with plugins (FREE)

As we have seen, another way to hide payment methods is to do so by product category , and for this there are some free plugins that offer this possibility for free.

WooCommerce Product Payments

The free version of this plugin serves for that exactly, for choose for what categories you will hide payment methods ] But your approach is different, in fact what you do is choose the payment method, only one, available for each category of product.

In your settings page you will find the list of your product categories, select one or several and choose your default payment method, the rest will be hidden on the final purchase page.

As you can see it is somewhat limited, since you can not select several payment methods by category

Booster for WooCommerce

In its free version you can hide each payment method by product category you just have to start typing category names in each payment method to hide it. [19659003] For this use it is quite more complete than the previous one since its approach is just the opposite, and the correct one. But, as you see, the options to hide gateways per product are disabled, only available in the plus version .

Hide methods of payment by product with plugins (DE PAGO)

Interestingly, all plugins that offer hide payment methods do not offer the option to do it for free, only by category so if you want this option with plugins, you have to go through box

Some plugins that offer that option in their paid version are these:

Booster Plus for WooCommerce ($ 19.99)

Now yes, in its paid version the fields are already active to hide payment gateways per product.

WooCommerce Payment GateWay per product premium (19.95 € / year)

This plugin is the version of payment of the free WooCommerce Products Payments and for this modest amount ad annual you can already specify which payment gateways will be available in each product, and in the right way, using a new widget in the product editor .

If you do not select any, all the gateways will be displayed, and if you select any one will be shown the ones chosen.

WooCommerce Conditional Shipping and Payments (79 $)

This plugin from the creators of WooCommerce offers, among its multiple configurations, the possibility of choosing which payment gateways will be displayed by product, category, country or shipping method. Very complete, yes, fully configurable as you can see in the following screenshot.

As you can see, something that I consider so Basic is not included in WooCommerce by default, but fortunately we have options to spare, paid and free.

Loading …

That may also help you:

How to modify the wp-config.php file without leaving WordPress

The WordPress configuration file, the famous wp config . php has multiple possible settings that we can add or modify but and what if we dare to do it without leaving our WordPress desktop?

Although I personally do not recommend ever modifying system files from the desktop, and this one is, there are times when you may need to modify some variable in the file wp config . php and I'll catch you without your own computer from which to access the cPanel of your hosting or by FTP .

It is on these occasions that plugins like WP Config File Editor can come to the rescue . [19659017]

Once installed and active you have a very complete interface, tant or through web form as in code editor, from which to do a lot of modifications :

  • Backup and restoration of wp-config.php.
  • Wizard and configurations for multisite. [19659020] Increase memory limits
  • Activate cache.
  • Configure parameters in entries, such as revisions, autosave, and more.
  • Configure language.
  • Configure WordPress security.
  • ] Configure the WordPress proxy.
  • Configure the access parameters to the WordPress database.
  • Test connection to the WordPress database access parameters.
  • Configure the repair of the WordPress database.
  • Configure automatic WordPress updates.
  • Configure cron.
  • Configure debug.
  • Configure security keys.
  • Change security keys to a click . [19659020] Filtering and validation of the entered fields to avoid breaking the file wp-config.php.
  • Change the values ​​of routes and URLs of the system.
  • List of constants associated with each field that you can modify.
  • Help in each field.
  • Save your configurations in different profiles.
  • Renew cookie name constants in one click.
  • Check system requirements.
  • Enable / disable write permissions for files. wp-config.php and .htaccess.
  • A lot more parameters.

The interface, immense, it's like this …

Is the plugin cool? Of course . It is complete? So much that it scares. Should I use it? Well only on very special occasions and for reasons of force majeure .

Also, keep in mind that in order to do something your file wp config . php must have write permissions, something I never recommend.

In any case it is good that you know him, because in more than one occasion you can get out of trouble . And it is also recommended for users who, wanting to make modifications to their file wp config . php do not feel comfortable with code editors and prefer to change parameters from a form.

In all cases use it under your responsibility .

Loading …

You may also find it helpful:

Urgent! Google Chrome and Firefox mark "Non-secure" webs without HTTPS

Surely you've already noticed that Google Chrome since the beginning of 2017 started labeling sites with HTTPS as safe, showing a green mark , visible in the address bar.

Well, from version 56 of the Google Chrome browser, which is scheduled for January 31, 2017 or be it already, label as " It is not secure " to sites without HTTPS, no active valid SSL certificate.

Come on, something ugly and scary for your visitors, let alone if possible future Buyers in your online store.

This tag from " is unsafe ", and also in red and with warning icon, will be displayed on any page of your site that contains a form where passwords or payment credentials are requested [194] 59011]as credit card numbers.

In fact, I have verified that is labeling as " Not safe " any WordPress site, even newly installed without store or anything.

So what do you prefer? …

This? …

Or this? …

What is this mania? Google with HTTPS?

Well, is not mania, it makes a lot of sense . The webs in HTTP transmit the data without encrypting, so any hacker could easily collect data from the users or clients of your web.

On the contrary, in HTTPS all the data travels encrypted, and the data of your users and customers are safe .

Also, if you want to offer your website under the new protocol HTTP / 2, with huge optimization and security improvements it is mandatory that you previously serve your website as HTTPS

All this evolution must not but improve consumer confidence in online commerce, in addition to improving the speed and safety of navigation, something that benefits us all do not you think?

Also Firefox

And not only Google Chrome, also the Firefox browser will mark as unsafe the webs without HTTPS according to reported some time ago so you do not escape from your clients that use this browser either. [19659019] Q What do I do if my site does not have HTTPS?

If your WordPress site does not yet have an SSL certificate and you do not serve your pages in HTTPS but in HTTP, and somewhere on your website there is a form that asks for a password, or you have a online store, and soon install an SSL certificate better if it is free, something that with the initiative Let's Encrypt fortunately is for everyone.

How do I install an SSL certificate? ? Are there free?

Easy, or you host your website in SiteGround where WordPress Help is hosted, and in addition to enjoying the best possible hosting you have by default pre-installed free SSL certificates in all plans.

Otherwise review this article where I explain how to install a free SSL certificate in your current hosting and activate it in WordPress .

Do I really have to install a certificate? SSL on my website?

Well, as I said before, and as directed by Google, you'll see if …

  1. You ignore the " suggestions " from Google of course after putting them to give birth for a while, stay comfortable, etc. to, then "remember that the truth is that you use many of their services and can not live without them, and that the reality they send in traffic from search engines and, or obey, or risk losing visits and sales, and you decide to return to the beginning of this article and do everything I told you
  2. On the contrary, you prefer to live dangerously at the risk of losing traffic and visits from Google, and credibility on the part of your visitors and / or future buyers, since the vast majority of the planet uses Chrome, the most widespread browser by far.

I said, yourself, but I personally all new websites for me or clients go on HTTPS, and one of the jobs that more are asking me lately is the migration to HTTPS so are you going to risk losing visits / customers to your competition?

Loading …

That may also help you:

How to create a semitransparent box in a text over a background image

When you add in Divi a text on a background image usually happens that, or see regular, or almost do not read the text depends on how the light or dark text fit on what part of the image has not happened?

I do not say anything if the text is on a carousel of images, in which one is clear and the other dark, then there is no way. The solution is because that text is in a semitransparent box and then it looks independent of the background image.

Doing it is very easy, simply open the image module or slide of the carousel (slider) where you want to add the text, you put your title or whatever and the background image, right up there right?

But the text will be fatal, not let's say if the image also has text, as in the example below, to which the letters can hardly be read ?, aside from the ugly and unprofessional that remains.

The solution is through add something called text overlay which you will find a little bit below in the settings of the module in question.

Although they are quite clear steps in the previous capture I summarize and order:

  1. Active superposition d e text
  2. You open the color selector, default without unfolding.
  3. You choose a base color, usually black or white, from which you will apply transparency / opacity. This step is COMPULSORY if you do not do anything, you always have to choose a primary color.
  4. You move the second selector to apply the desired opacity / transparency. Here is a bit of testing until you find the level that suits you best or better.
  5. Save the changes, of course.

Next, preview how your text looks over the image of background, but already with an opacity / transparency box that will allow the text to be much better distinguished and something much more pro is left?

You will see that for this type of adjustment is always better that the text is clear, as you may have guessed .

From there, if you want, you can customize the text box for example, making the rounded edges. Simply scroll through the tab of Advanced design settings and increase the value named Edge radius of text overlay (I know, the translation is horrible) until it fits your taste.

Preview and when everything is nice and especially readable you save the changes and you already have it. [19659004]

Your background image will still be seen back there in all its glory but your text will be legible.

This trick can be applied in the modules of sliders (sliders), in the publication title and in those of full-width title where they are most needed by the way.

Easy huh?

Loading …

It may also help you:

WooCommerce does not send emails, what do I do? • WordPress Help

The first thing you must understand is that if WooCommerce is not sending the order confirmation emails, etc. to your clients or to yourself surely this does not happen only with your online store, it is very possible that WordPress is not sending emails at all .

However there are specific configurations and specificities of WooCommerce by which may be that WordPress itself sends emails in general (new comments, new users, updates, etc.) and WooCommerce does not .

So let's see the possible problems and their solutions.

Orders not have been completed

It is quite common, more than you imagine, that the problem simply, especially in virtual products, that the payment gateway does not automatically process orders and because of this, As there is no effective order, WordPress / WooCommerce does not send any email because, simply, there is no complete order to inform, neither to you nor to your client.

This happens normally with payments to me. by Paypal and Bank Transfer which by default require manual confirmation on your part that the payments have been processed and completed for the order to be effective.

For that you must check first if the status of the orders is Waiting or Processing in which case the emails of shift will not be sent.

If you have questions about the WooCommerce ordering statuses here is the explanation of all possible WooCommerce order statuses .

How to fix it with bank transfers

If so, in In the case of bank transfer you have no other option than, when you see that you have received the payment in your account, mark the order as completed . and then you should send the emails of the order, both to the buyer and the seller.

How to fix it in the virtual payment gateways such as Paypal

If the cause is another virtual payment gateway, like PayPal, you can do the same as in the case of transfers, manual checking, or if you prefer – and you have it clear – force the completion of virtual orders with the codes and plugins that I published and can download here .

Automatically complete the orders in WooCommerce

Problem with the email address in the settings

It also happens a lot, but a lot, that WooCommerce does not send emails because you are using the default address of WordPress instead of your own.

To make sure that this is not the problem, or to fix it if it is, go for WooCommerce -> Ajust es -> Correos electr or nicos and check if the shipping address is and change it to another address of yours or a GMail email.

If you use a GMail address, remember to set up your Google account to allow access to less secure applications as in the following capture.

Problems with the mail server

And, finally, the other possible culprit is very likely that the server is not allowing the use of PHP ( ]) mail which is the one used by the function WP_mail () from WordPress.

In this case the solution is not to use that function, directly , and use instead an SMTP server for example from a GMail account of yours, or one created only for these purposes. [19659003] And to do it nothing better than the WP-Mail SMTP plugin, very easy to configure as we saw in the following article …

If WordPress does not send emails, how to fix it?

Nothing else for Today, I hope I have helped you solve the problem, and whether you have another possible solution or any question, do not hesitate to tell it in the comments.

Loading …

It might help you too:

How to fix HTTP 403 connection error with Jetpack • WordPress Help

An increasingly common error when trying to connect the Jetpack plugin to your account on is the well known like HTTP 403 which tells you that the Jetpack server could not connect to your site.

It's kind of ugly …

Why does the HTTP 403 connection error occur with Jetpack?

For your site to connect with the Jetpack servers in order for modules such as statistics, Photon and many others to work that require connection your web must have enabled the XML-RPC protocol which allows two-way connections between servers.

Ok, so what is XML-RPC?

In case you have not yet you knew, in every installation of WordPress there is a file called xml rpc . [19659010] php located in the root folder of your installation which is the one that allows this type of communications through the XML-RPC protocol .

This protocol is what allows, for example, that you can connect to your sites from the WordPress mobile application, that you can connect Jetpack and many other plugins that use direct server-to-server connection.

Do you want more information about what it is ?, here: What is XML? -RPC and what is it for .

Is there a problem with XML-RPC?

Yes, because it is like an open port to your website, that any attacker with bad intentions could use to take advantage of the known as pingback vulnerability .

Until version 3.5 of WordPress you could activate or deactivate this protocol in your settings but this option was removed , inexcusably, what he has facilitated not a few major attacks on WordPress sites .

How to disable XML-RPC?

The protocol XML-RPC can be disabled in several ways namely …

Disable XML-RPC from .htaccess

Just add this to your file . htaccess :

An alternative method is the following:

Save changes, of course.

Disable XML-RPC from wp-config.php

Also easy, before require_once ( ABSPATH . 'wp-settings.php' ) ; adds the following:

And save.

Disable XML-RPC with a function

You can also add the following code to your customizations plugin or to file functions . php of active topic:

Disable XML-RPC with plugins

You have a lot of free plugins in the WordPress plugins directory that are used to deactivate, completely or selectively, the protocol XML-RPC.

Disable XML-RPC to brava

More expeditious; simply access from the file manager of your server or by FTP to the folder of your WordPress installation and rename or delete the file xml rpc . [19659010] php .

But … should I really turn off XML-RPC?

Well it's something you should decide, but before making that decision review this list of the amount of WordPress functionalities that could stop working if you deactivate it .

My general advice is that you deactivate it, and if you see that something – important – does not work you activate it selectively (then we see how).

Okay, but I did not know that or deactivated anything. Why do I get an error?

Fortunately, yes, fortunately, more and more WordPress users are committed to the security of their websites, and as a result they install security plugins for protect your web And of course, many of these plugins inactivate the XML-RPC protocol.

If this is your case, you should review the settings of your security plugin and avoid blocking it, as simple as that. Where is it ?, depends on each plugin. For example, WordFence does not deactivate but others do.

To not block XML-RPC in iThemes Security go to Security [19659009] -> Settings -> Settings of WordPress and enables XML-RPC , inactive by default if you have this module active.

Another very popular plugin is All in One WP Security . In this case you can disable / enable XML-RPC in Security WordPress -> Firewall -> Rules b á sicas de Firewall – > WordPress XMLRPC & Pingback Vulnerability Protection and there unmark the box called " Completely Block Access To XMLRPC ".

If you want, you can check the following box, which keeps the functionality of XML-RPC but protects you from the pingback vulnerability that I have told you before.

Very cool everything but what if Jetpack does not work that way? I want a solution!

Vaaaale, there may be more things, like your hosting provider has it inactive by default, something that I'm also encountering lately, or other strange causes.

If you've read all of the above and you have clear that you have not deactivated XML-RPC neither manually nor with plugins, and you still want to use Jetpack, then I give you THE FINAL SOLUTION take note …


It's just 2 steps …

Allows connections to XML-RPC

Open the .htaccess file and add the following:

Save the changes.

With this already we are allowing the connections that JetPack needs and other applications

Disables the dangerous methods of XML-RPC

Next – IMPORTANT – installs and activates this fantastic plugin by Samuel Aguilera that it maintains active XML-RPC at the same time as it protects you from its vulnerabilities by removing the following methods from this protocol:

  • pingback.extensions.getPingbacks
  • X-Pingback of the headers HTTP

You have nothing to configure, is installed, you activate it and it is ready .

Once real Once these 2 steps are completed, you should be able to connect your site with Jetpack and safely …

Questions, opinions, kisses and hugs to the author of this article?

Loading …

may also help you:

Increase the visibility of the authors of your website with Yoast SEO

Do you have different authors in your blog? Do you want to give him more credit? Do you want to give more visibility to those who write on your website? Maybe with this you can do it. And is that the SEO plugins that serve to improve meta descriptions and titles also come with a plus: the possibility of improving the author profile .

Yoast SEO stuff

For example, with Yoast's SEO plugin (the standard, which you can download from the official repository) you can include the URL of the Facebook profile of the author who writes for you.

To do this you just have to fill in the section " URL of the Facebook profile " that appears in the editing section of each of your users. In the example you see where (I already tell you that it is with the Yoast plugin)

The Magic of Open Graph

This what makes is that appears in the source code a meta tag related to Open Graph which are the metadata that Facebook uses to know authorship, publication data, dates, and much more. This metadata will be as complete as complete we put them in our author file in its corresponding section.

Obviously, these data do not appear visually in your subject unless this allows it. It is something that the developer or the corresponding plugin must do conveniently.

In the webpage of the example that we are seeing, the author's data appears in the entry. But I'm telling you, this is not automatic, it's something that comes in the template that shows your website.

And what's the use of filling in the author's data? ] Well for, among many other things, give credit to the writer of the article on your website .

Imagine that you have many authors (it may not make much sense in the case of a single author, but it is that, maybe). So when someone shares the article on Facebook will appear a link pointing to your user file, personal or professional page .

In the case at hand, the article is from the website pharmacy. bio and is titled Why are there labels that put on gluten-free and yet have gluten? And it's written, as we've seen before, by Lucia Partera, the dietitian who works at the proprietary pharmacy this website.

Well, Lucía Partera has her own page on Facebook and the corresponding profile is filled in the section of the author of the online store. When this article is shared on Facebook if you look at the bottom, it appears FARMACIA.BIO | DE DIETAS Y MÁS, which is Lucia's page, the one that appears on her profile.

What's more, this section is actionable, that is, you can interact with it and allows you get to the Facebook page of the author of the post .

Not bad as a way to give visibility to people who write on your website right? But we have more doubts …

Does this happen in other social networks? Will it also work on Pinterest, Twitter and similar? We will continue to inform (and investigate). And if you've seen something funny like this, do not hesitate to comment.

Loading …

That may also help you: