mujuonly
Forum Replies Created
-
Forum: Plugins
In reply to: [WooCommerce] New field “GTIN, UPC, EAN, or ISBN”, not able to importFor importing, there is no need of a code snippet but a slight modification to the export code snippet is needed. Please see the updated code snippet below ( try an export after that ) and do an import with the exported file.
add_filter('woocommerce_product_export_column_names', 'add_custom_gtin_export_column');
function add_custom_gtin_export_column($columns) {
$columns['global_unique_id'] = 'meta:_global_unique_id';
return $columns;
}
add_filter('woocommerce_product_export_product_row', 'add_custom_gtin_export_row', 10, 3);
function add_custom_gtin_export_row($row, $product, $product_id) {
$gtin_value = get_post_meta($product_id, '_global_unique_id', true);
$row['global_unique_id'] = !empty($gtin_value) ? $gtin_value : '';
return $row;
}Forum: Plugins
In reply to: [WooCommerce] Different Hold stock minutes per Payment MethodHi @bluantinoo
Try using the below code snippet in the active theme functions.php file.
add_action( 'woocommerce_checkout_order_created', 'wc_reserve_stock_for_specific_payment_gateway', 5 );
function wc_reserve_stock_for_specific_payment_gateway( $order ) {
// Define the specific payment ID(s)
$target_payment_ids = array('cod', 'bacs');
// Define the time in minutes to hold stock
$stock_hold_minutes = 150;
if ( in_array( $order->get_payment_method(), $target_payment_ids ) ) {
// Remove the default functionality to hold stock for 60 minutes
remove_action( 'woocommerce_checkout_order_created', 'wc_reserve_stock_for_order' );
if ( ! apply_filters( 'woocommerce_hold_stock_for_checkout', wc_string_to_bool( get_option( 'woocommerce_manage_stock', 'yes' ) ) ) ) {
return;
}
$order = $order instanceof WC_Order ? $order : wc_get_order( $order );
if ( is_object( $order ) ) {
// Restore the functionality with a custom delay to hold the stock
( new \Automattic\WooCommerce\Checkout\Helpers\ReserveStock() )->reserve_stock_for_order( $order, $stock_hold_minutes );
}
}
}Use the below code snippet to show the shipping name instead of billing name in the order number column in the admin dashboard. Add the code in the active theme functions.php file.
add_filter( 'woocommerce_admin_order_buyer_name', 'woocommerce_admin_order_buyer_name', 10, 2 );
function woocommerce_admin_order_buyer_name($buyer, $order) {
$buyer = trim(sprintf(_x('%1$s %2$s', 'full name', 'woocommerce'), $order->get_shipping_first_name(), $order->get_shipping_last_name()));
return $buyer;
}Forum: Plugins
In reply to: [WooCommerce] New field “GTIN, UPC, EAN, or ISBN” not being exportedYou may use the below code snippet until it’s available in the default export, for exporting the newly introduced GTIN, UPC, EAN, or ISBN field. Add the code in the active theme functions.php
add_filter('woocommerce_product_export_row_data', 'woocommerce_product_export_row_data', 10, 3);
function woocommerce_product_export_row_data($row, $product, $exporter) {
$row['meta:__global_unique_id'] = get_post_meta($product->get_id(), '_global_unique_id', true);
return $row;
}
add_filter('woocommerce_product_export_column_names', 'woocommerce_product_export_column_names', 10, 2);
function woocommerce_product_export_column_names($column_names, $exporter) {
$column_names['meta:__global_unique_id'] = 'global_unique_id';
return $column_names;
}I suggest you look into the?Import Export Suite for WooCommerce.
This extension offers a wide range of features related to the import and export of WooCommerce data.Forum: Plugins
In reply to: [WooCommerce] Reverse customer’s first and last nameadd_filter('woocommerce_formatted_address_replacements', 'woocommerce_formatted_address_replacements', 10, 2);
function woocommerce_formatted_address_replacements($replacements, $args) {
$replacements['{name}'] = $args['last_name']. ' ' . $args['first_name'];
return $replacements;
}Try using the code snippet in the active theme functions.php file
Forum: Plugins
In reply to: [WooCommerce] Show only INSTOCK product in the [products] shortcodeHi Philippe( @camouyer ),
Add the below code snippet in the active theme functions.php file to display only the INSTOCK products.add_filter('woocommerce_shortcode_products_query', 'woocommerce_shortcode_products_instock_best_selling', 10, 3);
function woocommerce_shortcode_products_instock_best_selling($query_args, $attributes, $type) {
if ('best_selling_products' === $type) {
$query_args['meta_query'][] = array(
'key' => '_stock_status',
'value' => 'instock',
);
}
return $query_args;
}Forum: Plugins
In reply to: [WooCommerce] Help with plugin not compatible with WooCommerce HPOSIn this case, you can do it in two ways.
- Simple remove the WC Tested upto: header from the plugin base file.
2. Add HPOS compatibility declaration as per the WooCommerce developer guide here.
Note: It’s not recommended to edit the core plugin file.
Forum: Installing WordPress
In reply to: Error establishing a database connectionPlease try changing the database hostname from
localhost
to127.0.0.1
and check if it resolves the issue.Forum: Fixing WordPress
In reply to: Fatal Error! Clueless.The error is throwing from the theme of the website
'wp-content/themes/nordic/widgets/widget-latest-posts.php(86)'
Please try switching to a default theme or try fixing the error in the active theme to reinstate the website.Forum: Fixing WordPress
In reply to: Fatal error: Allowed memory size of 10737418241- Please try switching the theme temporarily to a default one ( may be twentytwentythree )
2- Try disabling plugins one by one so you can narrow down the issue.
3- Check the Error log file, if there are any errors logged that may include the line number of the code the issue is triggered from.
Forum: Fixing WordPress
In reply to: WordPress database error Table ‘wp_options’ doesn’t existEach time I set up a new WP, the same error happens. I am able to resolve this issue. But can this be fixed in the core itself.?
Forum: Plugins
In reply to: [WooCommerce] Action scheduler time limit VS WooCommerce Status time limitAction Scheduler always says “action timed out after 300 seconds” in different hosts where the WC Status PHP Time Limit varies accordingly.
Forum: Plugins
In reply to: [WooCommerce] WooCommerce REST API per_page limit@mouli Is there any option (hooks) to get all the resource in a single request.?
Forum: Fixing WordPress
In reply to: WAMP installation with public access@paulbarrett1952 You can try this question here in Stackoverflow under WAMP tag
Forum: Fixing WordPress
In reply to: How to integrate external forum with WordPress?You can use phpBB with WordPress. There are a few integration plugins at www.ads-software.com. Check this out.