New answers tagged

0

So, when I looked at the .htaccess file it had the following: <FilesMatch "\.(?i:php)$"> <IfModule !mod_authz_core.c> Order allow,deny Deny from all </IfModule> <IfModule mod_authz_core.c> Require all denied </IfModule> </FilesMatch> I removed that and the menu works correctly. This may open up risks ...


0

The server is setup correctly, no one should be able to execute php which is not at the root directory of wordpress (if he cares about the site's security). You can look into the htaccess or other server settings to figure out how it was done and remove it, but -10 for that option. The form and its server side handling do not make any sense at all. Either ...


-1

From the explanation you have posted it sounds like your webserver does not have permission to execute the PHP script. If the Webserver is Linux, you can use CHMOD and CHOWN commands to modify the persmissons and change the owner respectively, but if you are not familiar with linux, you are best asking your hosting support to help with this. You would need ...


0

I've discovered the answer myself after playing around a bit more. Go to woocommerce settings > shipping Click on the shipping method in the shipping zone (assuming you've added one already) in the 'cost' field put the price for shipping one item, then *[qty] which means multiplied by quantity. for example: 5.99*[qty]


0

@passatgt, make some edit in your wp-config.php file: define( 'WP_ALLOW_MULTISITE', true ); define('MULTISITE', true); define('SUBDOMAIN_INSTALL', false); define('DOMAIN_CURRENT_SITE', 'localhost'); define('PATH_CURRENT_SITE', '/plug/'); define('SITE_ID_CURRENT_SITE', 1); define('BLOG_ID_CURRENT_SITE', 1); after this edition you will see a 'Network Setup'...


0

// Reorder Checkout Fields add_filter('woocommerce_checkout_fields','reorder_woo_fields'); function reorder_woo_fields($fields) { $fields2['billing']['billing_email'] = $fields['billing']['billing_email']; $fields2['billing']['billing_first_name'] = $fields['billing']['billing_first_name']; $fields2['billing']['billing_last_name'] = $fields['billing']['...


0

You can check woocommerce related conditional tag here - https://docs.woocommerce.com/document/conditional-tags/ You can try below code. In this code add_action execute only when product have category like men or women. function wp_extracode_for_products() { echo'your code'; } add_action( 'wp', 'remove_product_content' ); function ...


0

check the documentation to add something for a particular posts/pages/category http://codex.wordpress.org/Conditional_Tags


1

Looks to me you should be seeking a woocommerce purchase completion hook. This would be when you could add that a donation has been made and at what amount, then you could grab any user information, amounted donated and other info you need and save it to your donor table. use this: add_action('woocommerce_order_status_completed', 'save_to_donors',10,1); ...


1

This action hook allows you to access data for a new user immediately after they are added to the database. The user id is passed to hook as an argument. Not all user meta data has been stored in the database when this action is triggered. For example, nickname is in the database but first_name and last_name. The password has already been encrypted when ...


-1

NOTE: This answer looks irrelevant to the OP's question after further analysis of the added/updated function in the question. Im leaving this answer in place and creating a new answer for historical use, since part of the question seems applicable. You could use something like the following to create user meta when users are added to the user table. Put ...


0

this not perfect way to write inline java script , write java script into document ready event jQuerydocument ).ready(function() { jQuery( ".wc-proceed-to-checkout" ).css("display", "none"); });


0

You can get all child category by using parent category id, I am using this code for access child product category $cat_id = 1; // A Category id $temp_terms = get_terms(array( 'taxonomy' => 'product_cat', 'parent' => $cat_id, 'order_by' => 'name', ));


0

That's because get_post_meta_by_key() isn't a WordPress function. What you're likely looking for is get_post_meta(): add_action( 'woocommerce_after_shop_loop_item', 'display_author' ); function display_author() { global $post; echo get_post_meta( $post->ID, 'author', true ); } Not tested, because I don't have a WooCommerce install handy (and ...


0

You will find the Codex Action Reference handy - while it doesn't list everything, it gives a good overview of action order which can help locate the correct action if the one you're using runs too late. In your case, wp does indeed run after the query is run, but looking at that list it appears - depending exactly on what logic you're wanting to run - that ...


0

For woocommerce there is only 1 plugin provided by Woocommerce developers. There is no concept of popular plugins for woocommerce The URL is : https://wordpress.org/plugins/woocommerce/ The Popular tab is there to display the most popular plugins used by people around the world. It is based on the active installed.


0

If I understand your question correctly, you would set a your preferred featured image/thumbnail dimensions either in Settings or, if you have or need a new special image type, by adding it to your functions PHP - something like: add_image_size( 'product_preview', 55, 55, true ) ; In order to retroactively crop the old images, pretty much standard practice ...


-1

I figured I'd post the answer here as well in case someone else is going to look for the answer. Why the sale price wasn't changing completely was because I wasn't changing al the required fields. Woocommerce has 3 different fields for keeping the price for every product. There is the regular price field, sale price and a third one. When I set the sale ...


-1

The markup of your button is <input disabled="" class="woocommerce-Button button" value="Reset Password" type="submit"> it shouldn't be disabled, removing the disabled attr doesn't seem to fix the problem, but I think that this button is "Decoration", and it is not associated with any ajax request, the theme default functionality for reset password ...


0

if you take a look in the database in wp_postmeta table you will see meta_key will be _featured and meta_value will be yes or no so instead of value 0 or 1 write yes or no <?php $q = new WP_Query([ 'post_type' => 'product', 'stock' => 1, 'showposts' => 3, 'orderby' => 'date', 'order' ...


0

I think it would be best to do a template override in Woocommerce. If by single you mean a page when viewing only one product then look at the single-product.php template. The directory it needs to located is: /public_html/wp-content/themes/your-theme/woocommerce/single-product.php. You can download the template overrides from woothemes.


1

Remove return; from your code, which is prematurely exiting the function before the following two lines can be executed; that is why the status is not changed. function my_change_status_function () { global $post; $ordernumber = get_post_meta( $post->ID, 'order_number', true ); $audit_status = get_post_meta( $post->ID, 'audit_status', ...


0

There's probably a few ways to do this. The key will be cutting down on the number of loops you need to make it more efficient. I think this will work: $query = new WP_Query( array( 'post_type' => 'product', 'posts_per_page' => '-1', // unlimited posts 'tax_query' => array( array( 'taxonomy' => 'product_tag', ...


0

Although 61 MB should generally be enough for WordPress, depending on what you're doing you may sometimes need to set the memory limit higher. Creating a menu with a large number of links could well be causing you to hit this limit. Increasing memory allocated to PHP in the Codex explains how can set it higher (as long as it's not blocked by your host), ...


0

You might be able to use the advanced costs to set the "dynamic" costs for the Priority and Expedited shipping methods. The cost could be based on the number of items in the cart or the cost of the total cart. See the docs linked.


0

EDIT: I tried the following and it works in the theme "Storefront for woocommerce"(Though it needs additional styling). For some reason though, it does not work well with the twentyfifteen theme.(The submenu does not show.) add_filter( 'wp_nav_menu_items', 'wc_products_on_nav_menu'); //filter to add the html add_action( 'save_post_product', '...


0

If you want to get product filter by category and brand (both) so you can add following code.. $args = array( 'post_type' => array('post','product'), 'tax_query' => array( 'relation' => 'AND', array( 'taxonomy' => 'product_cat', 'terms' => 82, 'field' => 'id' ), array( ...


0

You can get selected product variation from these code.. $product_id=$_POST['product_id']; $plan = wc_get_product($product_id); $variations = $plan->get_available_variations(); if(!empty($variations)) { foreach ($variations as $value) { echo "<pre>";print_r(value);echo "</pre>"; } }


1

Googling get_terms gives the WP developer hub page for get_terms as the first result, for which the first example is this: $terms = get_terms( 'post_tag', array( 'hide_empty' => false, ) ); Using this as a basis we get: $args = array( 'taxonomy' => 'product_cat', 'number' => 5, 'orderby' => 'name', 'parent' => 11, '...


0

By default, WordPress posts set to private are visible to admins, and you can distinguish them on the frontend because they have 'Private:' prepended to their title. However, you might have plugins installed that are modifying this behaviour. It could be your capability management plugin, or it could be WooCommerce. The specifics of third-party plugins are ...


0

I'm not sure at first glance why this is only working on your home page and not your archive pages, but there are a few things wrong with the way this function is written. So, I've rewritten it for you below - using this instead might solve the problem if it was introducing an esoteric bug before. A couple of things to note: relation should not be used ...


0

I might be completely missing what you want here, but it sounds like you're saying you want the parent category's slug to echo out, rather than the parent category's human readable name. Rather than this: echo $parent->name; You just need this instead: echo $parent->slug; You can see a list of the properties here that are returned by the ...


2

function woocommmerce_style() { wp_enqueue_style('woocommerce_stylesheet', WP_PLUGIN_URL. '/woocommerce/assets/css/woocommerce.css',false,'1.0',"all"); } add_action( 'wp_head', 'woocommmerce_style' ); paste the above code in your "functions.php". woocommerce stylesheet will be executed to your site


0

I'm not sure what the job_listing post type refers to - it's probably part of a feature included in your theme - but in order to limit your search results by post type, the usual way to do this is by hooking into WordPress' pre_get_posts action in your theme's functions.php. Because you're new to this, a couple of other answers you should have a quick read ...


0

Is this form only filled out once? Or can users be sent back to it, needing it to know what they have already selected? If the former, it's not too difficult to select the option you want. You just need to replace this: <?php checked( $current_value, 1 ); ?> with this: <?php checked( '2491-maintenance-packages-0', sanitize_title( $option['...


0

Finally I used the wp_set_password(); function as the emergency reset script documentation of Wordpress explains, which helped me to set a new password for my admin account.


1

Anything outside the <?php ?> tags will be echoed as output since it has no conditions. The fastest way is to wrap in a function and output in the footer. add_action('wp_footer','custom_random_script'); function custom_random_script() { echo '<script> ......SCRIPT CONTENTS...... </script>'; } There is nothing technically ...


0

This solution seems to be very close to what you need. But can't say duplicated as you will need to do some coding to get 2nd email address. Check out. Adding a second email address to a completed order in WooCommerce To get email field from checkout try get_post_meta( $order_id, '_custom_field', true ); now you might want to get $order_id add_action ('...


0

I found this. /** * @snippet Disable Link to Products @ Loop * @how-to Watch tutorial @ http://businessbloomer.com/?p=19055 * @sourcecode http://businessbloomer.com/?p=19916 * @author Rodolfo Melogli * @testedwith WooCommerce 2.5.2 */ // Close </a> tag just after it opens before product item add_action( '...


0

WooCommerce save this data as metadata so you'll need to run a Meta Query against the name _visibility. Something like: 'meta_query' => array( array( 'key' => '_visibility', 'value' => 'hidden', 'compare' => '!=', ) ) This will pull all posts that do not have meta _visibility equal to hidden.


0

It's seems you have all variations same price. That's why it's not showing, it's a WooCommerce default behavior. You can change this WooCommerce default variable price filter with this hook. add_filter('woocommerce_show_variation_price', function() { return TRUE;});


1

I tried another solution and that did the trick. I found in the WooCommerce docs this little snippet: // Display 24 products per page. Goes in functions.php add_filter( 'loop_shop_per_page', create_function( '$cols', 'return 24;' ), 20 );. It is overriding the settings in the customizer. I only have to change the number '24' to my liking.


0

You can wrap your plugin in a check to see if WooCommerce is installed and active or not : if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { echo 'WooCommerce is active.'; } else { echo 'WooCommerce is not Active.'; }


-1

Get all woocommerce product and its details like sku,price,product name $sql = "SELECT * FROM `wp_posts` wp LEFT JOIN wp_postmeta wpm ON wp.ID=wpm.post_id WHERE post_type='product'"; $results = $wpdb->get_results($sql); print_r($results);



Top 50 recent answers are included