Decode HTML Tags from Woocommerce Error Message

Decode HTML Tags from Woocommerce Error Message

This is live scenerion when we used checkout custom plugin and passed HTML link inside label, this HTML tag will display in woocommerce error as required field. To show HTML decode or remove HTML tags I prefered to use wordpress predefined function wp_specialchars_decode with ‘ENT_QUOTES’ inside filter woocommerce_add_error. Below filter will run each time when…

Woocommerce Filter

Woocommerce Filter

Remove product link on checkout page Using add filter woocommerce_cart_item_name we can modify woocommerce product name with condition check for checkout page. //remove product link on checkout page add_filter(‘woocommerce_cart_item_name’, ‘custom_filter_wc_cart_item_remove_link’, 10, 3); function custom_filter_wc_cart_item_remove_link($product_name, $cart_item, $cart_item_key) { if (is_checkout()) { $wccart = new WC_Cart(); $name = apply_filters(‘woocommerce_cart_item_remove_link’, sprintf( ‘ ‘, esc_url($wccart->get_remove_url($cart_item_key)), __(‘Remove this item’, ‘woocommerce’),…

Adding Custom Field in Export Products Dropdown Woocommerce

Adding Custom Field in Export Products Dropdown Woocommerce

When we need to add custom field in dropdown list of Woocommerce product export filter. We can add below Filter Hook. By defualt when we select ‘Export all columns’ Woocommerce will export all values. function add_export_data( $product, $name ) { $pid = $product->get_id(); if($product->get_type() == ‘variation’){ $pid = $product->get_parent_id(); } $sale_code = get_post_meta( $pid, $name,…

How to Enable Temporary URL From WHM

How to Enable Temporary URL From WHM

Advantage of enabling temparory URL (Example: http://yourdomain.com/~username) * When we develop website or don’t have domain name. * For staging website Steps to enable temporary URL but recommended to disable once development phase done. 1) Login to WHM. 2) Navigate to ‘Security Center’. 3) Click on the icon ‘Apache mod_userdir Tweak’. 4) Uncheck the option…

How to protect file if User not logged in WordPress

How to protect file if User not logged in WordPress

If User not logged In and try to download .PDF file or any other extension below code will protect file even if User try to download via direct link. 1. Add code in function.php or your plugin file. Update permalink after adding this code. This code will add htaccess rules in .htaccess file. add_filter(‘mod_rewrite_rules’,’output_htaccess’);function output_htaccess(…

Upload multiple files, insert into database, send email with multiple attachments

Upload multiple files, insert into database, send email with multiple attachments

WordPress Custom code to upload files and save data into the database after successful upload send all files as attachments in an email to user. Do you want professional help? We’ll repair it for you! Get assist Contact here! if(isset($_POST[‘status’])){ $uploaddir = ‘/home/public_html/wp-content/uploads/order-doc-folder/’; foreach($_FILES[‘docat’] as $key => $doc){ if($_FILES[‘docat’][‘name’][$key] != ”){ $temp = explode(“.”, $_FILES[‘docat’][‘name’][$key]);…