Anchor link to every product

You can use the woocommerce_loop_product_link filter to modify the archive product urls. // Add to (child) theme functions.php function my_prefix_modify_woocommerce_loop_product_link( $url, $product ) { /** * Adds the id of the product wrap element from single product view * as an anchor parameter to the WooC archive loop product url * e.g. http://www.mystore.com/my-product#single-produt-wrap-id * update … Read more

add custom menu in woocommerce dashboard [closed]

You can use the following to create a sub menu under woocommerce. Please use the following for reference. https://developer.wordpress.org/reference/functions/add_submenu_page/ add_action(‘admin_menu’, ‘testing_submenu_page’); function testing_submenu_page() { add_submenu_page( ‘woocommerce’, ‘sub menu’, ‘sub menu’, ‘manage_options’, ‘woo-subpage-test’, ‘test_callback’ ); } function test_callback() { echo ‘<div class=”wrap”><div id=”icon-tools” class=”icon32″></div>’; echo ‘<h2> Sub menu test page</h2>’; echo ‘</div>’; } Example what the … Read more

Hiding all products except for one in wordpress admin panel

You have to use pre_get_posts hook to alter the WordPress main query. $query->get() : https://developer.wordpress.org/reference/classes/wp_query/get/ is_admin() : https://codex.wordpress.org/Function_Reference/is_admin pre_get_posts hook : https://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts // Handle the main query and set the post ID to 9 function wpse_288586_hide_products($query) { // We have to check if we are in admin and check if current query is the main … Read more

Customizing the add to cart function

To do this you need to use the woocommerce ‘woocommerce_add_to_cart’ hook to add your custom function. something like this : add_action(‘woocommerce_add_to_cart’, ‘my_function’); function my_function(){ //…….. } This has been answered in another question here : https://stackoverflow.com/a/34255005/3134410

Send form data to functions.php

The answer is AJAX. Each time the totals are calculated, send the form data to the wp ajax handler. Step 1: pass your ajax URL from PHP to javascript using wp_localize_script just after you enqueue your script file. wp_enqueue_script(‘myScript’, ‘my/script/path.js’); wp_localize_script(‘myScript’, ‘php_params’, [‘ajaxurl’=>admin_url(‘admin-ajax.php’)]); Step 2: make the AJAX call in your script. $.ajax({ type: “POST”, … Read more

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