Via the product settings I enabled “sold individually: enable this to only allow one item to be bought in a single order” While adding the same product to cart, there appears an error message because I enabled this setting. The error message is “You cannot add another ‘xxx’ to yo…
Tag: wordpress
Trying to get a list of unique events from wp_posts with data from wp_postmeta
I’ve spent about 4 hours trying to figure out why I cannot do a group by of the post_title and left join the date data from the wp_postmeta table The code without the group by clause, results all my events but I only want to retrieve the first instance of the event, by grouping by the post_title, which …
add specific text to a customm fields with php (wordpress)
I want to add text “Genre:” to the beginning of this custom field the reason that i dont simply add something like this is that i dont want to this text be shown when there isnt this field for a post Answer You can check if the field exists and then display your HTML element.
Loading Templates from a plugin in WordPress
I’m trying to make my first plugin and I got stuck. Here is the idea. When my plugin is activated it will create one post type and two taxonomies for that post type (in my case the post type name is ‘Ads’). Also, I created two template pages, one to display the listing of all ads post type a…
Change default user profile URL – BBpress Plugin
Bbpress WordPress Plugin have default link user profile url. The link like this: www.example.com/forum/users/(username) The main purpose in nutshell is: I want to change the url. Actually, I found the solution but its not perfect. The code like this: Yes, the code working well. But the outcome is, the user pr…
Change “Remove” link text for WooCommerce coupon on checkout page
Instead of [Remove] on the WooCommerce checkout for added coupons, I would like the text to be [Remove & Re-Calculate]. I am using the following and the text is changed but there is no link (the coupon cannot be removed). This is what I tried: Answer includes/wc-cart-functions.php contains at line 293, ju…
How to save from WooCommerce checkout a custom checkbox field state?
I have a problem with the update_post_meta function. I have a user submitted value, which I pass via $_POST and then saving to post meta. All is working fine, but when the value is ‘0’ the post meta is not updated. This is My code: Does anyone have any idea what might be wrong? Answer Since WooCom…
Remove “Search Results: ‘%s’” and blank space from Woocommerce Shop Search Results Page
I am trying to remove the “Search results: ‘ ‘ ” text that shows above products on the Woocommerce Storefront search results page. Below is an image with the referenced text circled: I have …
WordPress PHP | get_permalink() stripping slashes. Cant add extra slash
I have social media buttons to share a URL. My code looks something like $socialURL = get_permalink(); //trying to add extra slash here $socialURL = str_replace(‘https://’, ‘https:///’, $socialURL); …
Assign a percentage fee to WooCommerce payment methods based on user roles
How do I expand this snippet to include 2 more payment gateways with different fees? The payment gateways I want to add are ‘cardgategiropay’ and ‘cardgateideal’ and the fees are 3% and 2% …