Woocommerce digital download not working – database error Cannot add or update a child row: a foreign key constraint fails [closed]

Just go to your database, drop table ending with “wc_download_log” (it might have a prefix). After droping the table deactivate Woocommerce and activate it again. That will solve the trick. Just be careful, drop just that table, be sure to back things up first. This post helped me solved this: https://wordpress.org/support/topic/unable-to-insert-download-log-entry-in-database/page/2/#post-13359528

Change order of combined product tabs

Literally just swap the order of them in the code: add_filter( ‘woocommerce_product_tabs’, function( $tabs ) { $tabs[‘description’][‘callback’] = function() { global $product; if ( $product && ( $product->has_attributes() || apply_filters( ‘wc_product_enable_dimensions_display’, $product->has_weight() || $product->has_dimensions() ) ) ) wc_get_template( ‘single-product/tabs/additional-information.php’ ); } wc_get_template( ‘single-product/tabs/description.php’ ); }; return $tabs; }, 98 );

How to retrieve a Menu Name by Menu Location with ACF fields

To retrieve the Menu Name: $menu_name = wp_get_nav_menu_name(“menu-products”); Then, using the menu name you can get data like the nav menu: $term = get_term_by(‘name’, $menu_name, ‘nav_menu’); And using the term taxonomy ID you can pull the ACF fields $menu_id = $term->term_taxonomy_id; $post_id = ‘term_’.$menu_id; $field = get_field(‘my_acf_field’, $post_id); To retrieve list of menu Items: $menu … Read more

Display WooCommerce product attribute on shop page

Just make a check, if you have any applications available, and if so – echo them. Here is an example: add_action( ‘woocommerce_after_shop_loop_item_title’, ‘display_applications_attribute’, 5 ); function display_applications_attribute() { global $product; $applications = $product->get_attribute(‘pa_applications’); if ( $applications ) { printf(‘<span class=”attribute-applications”>Applications: %1$s</span>’, $applications ); } }