Woocommerce Custom product fields need to be editable after purchase in View Orders Page

I am Using https://stackoverflow.com/questions/46612499/display-a-custom-field-value-in-woocommerce-orders-edit-view/#answer-46615303 answer code, which works fine.

I want to display that checkout custom fields on My Account > View Order Pages, to allow customer to edit its value after purchase, so Customers can change and save the custom field value.

Any help?

Checkout Page Is Keep Loading After Integration Of Payment Gateway In Magento2

Checkout page is Keep loading after integration of any payment gateway. I have tested with multiple payment gateway using module when i try to checkout the product keep loading.

[Loading Page Snap of checkoutpage] https://i.stack.imgur.com/MvINp.png

[Console Snap of checkoutpage] https://i.stack.imgur.com/2O4aL.png

I want to get the value of a select attribute in the checkout page, and then use it to show or not the delivery data

I want to get the value of a select attribute in the checkout page on WooCommerce, and then use it to show or not the delivery data.

I have tried everything but it still does not appear, the object of my products when I go through it comes out empty.

I have tried something similar to this to see what data I am getting but it comes out empty:

add_filter( 'woocommerce_cart_item_name', 'cart_variation_description', 20, 3); function cart_variation_description( $  name, $  cart_item, $  cart_item_key ) {     // Get the corresponding WC_Product     $  product_item = $  cart_item['data'];      if(!empty($  product_item) && $  product_item->is_type( 'variation' ) ) {         // WC 3+ compatibility         //$  descrition = $  product_item->get_description();         //$  descrition = $  product_item->get_attribute( 'pa_modo' );         $  descrition = $  product_item->get_post_meta( $  variation->ID, 'price_1_50', true );         $  result = __( 'Description: ', 'woocommerce' ) . $  descrition;         return $  name . '<br>' . $  result;     } else         return $  name; } 

Thanks a lot.

I have duplicate home page, How Can I fix it?

Using some website audit tools I found that it says a lot that I have a duplicate content like so:

https://example.com/ https://example.com/index.php 

in my sitemap I only have:

<url>   <loc>https://www.example.com/</loc>      <xhtml:link rel="alternate"                hreflang="it"                href="https://www.example.com/"/>     <xhtml:link rel="alternate"                hreflang="en"                href="https://www.example.com/en/index.php"/> </url> 

I don’t know why google splits it up into two links. How can I fix it?

(PS https://www.example.com/en/ and https://www.example.com/en/index.php doesn’t give me this problem )

Woocommerce sale flash badge not showing in products page [closed]

the problem that I have is this. I am just helping someone with their woocommerce/wordpress website, I am not very experienced with it but they need some urgent help. Basically, they want to show a badge whenever a product is on sale. I just found the way to do it and it is working fine, but only in the single product page. In the page of a single product, in the related products it shows the badge in the discounted products. But in the general products page it does not show anything. This is the code I got for the single product pages:

function sales_badge( $  text, $  post, $  product ) {         return $  tagType = '<span class="onsale"><img style="max-width: 150px;" src="sale.jpg"></span>'; } add_filter('woocommerce_sale_flash', 'sales_badge', 99, 3 );  

For the theme we are using: Astra and Elementor. I have tried everything and in google but could not find anything related with this. FYI: we are not using any plugin for this and we do not plan to.

Redirect a page id url but not the page slug

My client is asking me to force a 404 $ wp_query->set_404(); if the url is domain.com/page_id=342 but DON’t redirect if the url is domain.com/about even though they are the same page. I have to do this in the functions.php file and not .htaccess.

I have tried

add_action('init','add_get_val'); function add_get_val() {   if (isset($  _GET['page_id'])) {     $  param = $  _GET['page_id'];        if($  param == '342') {          global $  wp_query;            $  wp_query->set_404();            // status_header( 404 );            // get_template_part( 404 );             // exit();     }  }  } 

The code as it stands does not work. But if I uncomment the status_header, get_template…, and exit it does, however, it does not give the same 404 page.

What am I doing wrong?

How to get sale product first on category listing page woocommerce?

I want to sort product on category listing page. Want to display sale product first and remaning product after sale product. I have used woocommerce_get_catalog_ordering_args hook for sorting but not working.

My code looks like this

function catalog_ordering_args( $  args ) {     if( !is_product_category() ){         return $  args;     }      $  args['orderby'] = 'meta_value_num';     $  args['order'] = 'ASC';     $  args['meta_key'] = '_sale_price';      return $  args; } add_filter( 'woocommerce_get_catalog_ordering_args', 'catalog_ordering_args', 20, 1 ); 

It should also work for variation products

how to embed Pdf and Video Without effecting page speed?

I have a WordPress site and I upload a lot of pdf and videos use embedding techniques but now my website speed is very low. so i want to increase the page speed now, I am going to delete all the iframe from my website and want to replace them with responsive iframe, but I don’t know how to use embedding. currently, i embedded all pdf using google drive embedding. should I stop embedding??

Function only on a specific page

I am trying to run a function only on one page or other pages in the future if I so desire. But I dont want to run it site wide. I need help on how to put the if is_page or if is_single.

// disable auto-formatting function my_formatter($ content) { $ new_content = ''; $ pattern_full = '{(\[raw\].*?\[/raw\])}is'; $ pattern_contents = '{\[raw\](.*?)\[/raw\]}is'; $ pieces = preg_split($ pattern_full, $ content, -1, PREG_SPLIT_DELIM_CAPTURE);

foreach ($  pieces as $  piece) {     if (preg_match($  pattern_contents, $  piece, $  matches)) {         $  new_content .= $  matches[1];     } else {         $  new_content .= wptexturize(wpautop($  piece));     } } return $  new_content; 

} remove_filter('the_content', 'wpautop'); remove_filter('the_content', 'wptexturize'); add_filter('the_content', 'my_formatter', 99);

Much appreciate the help.