Woocommerce Add Variation Product to Cart from custom link [closed]

i currently work on a woocommerce v2.1.12 shop and it seems they chaged that behavior. my ajax url to add items to the cart has to look like this: ?add-to-cart=[PRODUCT-ID]&variation_id=[VARIATION-ID]&attribute_[ATTRIBUTE-NAME]=[ATTRIBUTE-SLUG]&attribute_[ATTRIBUTE-NAME]=[ATTRIBUTE-SLUG] example: http://example.com/store/category/product/?add-to-cart=239&variation_id=240&attribute_pa_size=48-2&attribute_pa_color=gold this adds a specific product to the cart and also sets the variation attributes in the cart. you can even set the quantity … Read more

Contact form 7 select box different value-text than content-text in option [closed]

It looks like this is supported by Contact Form 7 natively, it’s just not very obvious on how to make it happen. Here’s a documentation page explaining the functionality: http://contactform7.com/selectable-recipient-with-pipes/ Basically, all you have to do is put the values like so: “Visible Value|actual-form-value” What comes before the pipe | character will be shown in … Read more

Create a custom archive page for a custom post type in a plugin

What you need is hooking template_include filter and selectively load your template inside plugin. As a good practice, if you plan to distribute your plugin, you should check if archive-my_plugin_lesson.php (or maybe myplugin/archive-lesson.php) exists in theme, if not use the plugin version. In this way is easy for users replace the template via theme (or … Read more

Can I upgrade a plugin to a specific version?

Using WP-CLI you can specify this as described in the official documentation. $ wp plugin update <plugin> Using either of the following arguments –minor Only perform updates for minor releases (e.g. from 1.3 to 1.4 instead of 2.0) –patch Only perform updates for patch releases (e.g. from 1.3 to 1.3.3 instead of 1.4) –version=<version> If … Read more

How do i know the current post type when on post.php in admin?

add_action( ‘admin_init’, ‘do_something_152677’ ); function do_something_152677 () { // Global object containing current admin page global $pagenow; // If current page is post.php and post isset than query for its post type // if the post type is ‘event’ do something if ( ‘post.php’ === $pagenow && isset($_GET[‘post’]) && ‘post’ === get_post_type( $_GET[‘post’] ) ) … Read more

How to customize woocommerce related products? [closed]

Firstly, you can’t immediately achieve the goal you described with the code you show in your question. To understand why there isn’t a direct approach with that code you have to take a look at what you’re using – woocommerce_related_products() – to do what you have done so far. Secondly, you have to understand, because … Read more

How to reorder billing fields in WooCommerce Checkout template? [closed]

Same can be done through functions.php in your (child) theme: add_filter(“woocommerce_checkout_fields”, “order_fields”); function order_fields($fields) { $order = array( “billing_first_name”, “billing_last_name”, “billing_company”, “billing_address_1”, “billing_address_2”, “billing_postcode”, “billing_country”, “billing_email”, “billing_phone” ); foreach($order as $field) { $ordered_fields[$field] = $fields[“billing”][$field]; } $fields[“billing”] = $ordered_fields; return $fields; }

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)