/*Sample Product Add To Cart Ajax*/
add_action("wp_ajax_roomeo_woocommerce_sample_ajax_add_to_cart", "roomeo_sample_add_cart_wallpaper");
add_action("wp_ajax_nopriv_roomeo_woocommerce_sample_ajax_add_to_cart", "roomeo_sample_add_cart_wallpaper");
function roomeo_sample_add_cart_wallpaper(){
$product_id = $_POST['product_id'];
$product_type = $_POST['product_type'];
$attach_url = wp_get_attachment_url( get_post_thumbnail_id($product_id) );
// Check for free sample in cart and break loop early if found
if ( $product_type == 'free' ) {
foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
if($cart_item['product_type'] == 'free'){
$data = array(
'response' => 'failure',
'message' => "You can not add more free sample in cart.",
);
echo wp_send_json($data);
die();
}
}
}
$product_image = get_post_meta($product_id, 'main_wallpaper_image', true);
$numbers = '';
// Use cached result for regex matching
if ($product_image) {
preg_match('/\d+/', $product_image, $matches);
$numbers = $matches[0] ?? '';
}
// Check attach_url once
if (!empty($attach_url)) {
$attach_url = wp_get_attachment_url( get_post_thumbnail_id($product_id) );
} elseif ($product_image != '') {
$attach_url = fetch_cloudflare_image_roomeo($product_image);
} else {
$attach_url = get_template_directory_uri() . "/assets/images/woocommerce-placeholder.png";
}
$total_price = ($product_type == 'free') ? 0 : get_post_meta($product_id, '_sample_price', true);
// Optimize the image for free sample
if ($product_type == 'free') {
$img_url = get_field('free_sample_image', 'options');
$attach_url = !empty($img_url) ? $img_url['url'] : get_template_directory_uri() . "/assets/images/woocommerce-placeholder.png";
}
$cart_item_data = array(
'ProductID' => $numbers,
'custom_price' => $total_price,
'product_type' => $product_type,
'attach_url' => $attach_url,
);
$cart_item_key = WC()->cart->add_to_cart($product_id, 1, 0, '', $cart_item_data);
$data_array = array(
'response' => 'success',
'cart_item_key' => $cart_item_key,
);
echo wp_send_json($data_array);
die;
}
/*Custom Wallpaper Product Add To Cart Ajax*/
add_action("wp_ajax_roomeo_add_cart_wallpaper", "roomeo_add_cart_wallpaper");
add_action("wp_ajax_nopriv_roomeo_add_cart_wallpaper", "roomeo_add_cart_wallpaper");
function roomeo_add_cart_wallpaper(){
$product_id = $_POST['product_id'];
$height = $_POST['height'];
$width = $_POST['width'];
$total_size = $_POST['total_size'];
$img_type = $_POST['img_type'];
$file = $_FILES['image'];
// Upload and process image in background (asynchronously)
$attachment_url = roomeo_process_image_async($file, $img_type);
$price = wc_get_product($product_id)->get_regular_price();
$total_price = number_format((float)$total_size * $price, 2, '.', '');
$cart_item_data = array(
'ProductID' => $product_id,
'custom_price' => $total_price,
'product_type' => 'custom_design',
'height' => $height,
'width' => $width,
'img_type' => $img_type,
'total_size' => $total_size,
'attach_url' => $attachment_url,
);
$cart_item_key = WC()->cart->add_to_cart($product_id, 1, 0, '', $cart_item_data);
echo wp_send_json(array('cart_item_key' => $cart_item_key));
die;
}
// Process image asynchronously
function roomeo_process_image_async($file, $img_type) {
$upload_dir = wp_upload_dir();
$upload_path = str_replace('/', DIRECTORY_SEPARATOR, $upload_dir['path']) . DIRECTORY_SEPARATOR;
$file_name = $file['name'];
$file_tmp_name = $file['tmp_name'];
$hashed_filename = md5(uniqid()) . '_' . $file_name;
// Move uploaded file to destination
move_uploaded_file($file_tmp_name, $upload_path . $hashed_filename);
$file_type = $file['type'];
$attach_id = wp_insert_attachment(
array(
'post_mime_type' => $file_type,
'post_title' => preg_replace('/\.[^.]+$/', '', basename($hashed_filename)),
'post_content' => '',
'post_status' => 'inherit',
'guid' => $upload_dir['url'] . '/' . basename($hashed_filename),
),
$upload_path . $hashed_filename
);
// Offload image processing to background
roomeo_process_image_filter($upload_path, $hashed_filename, $img_type);
return wp_get_attachment_url($attach_id);
}
// Process image filter in the background
function roomeo_process_image_filter($upload_path, $filename, $img_type) {
// Create grayscale or sepia filter
$im = imagecreatefromjpeg($upload_path . $filename);
if ($img_type == 'grey') {
imagefilter($im, IMG_FILTER_GRAYSCALE);
} elseif ($img_type == 'sepia') {
imagefilter($im, IMG_FILTER_GRAYSCALE);
imagefilter($im, IMG_FILTER_COLORIZE, 70, 50, 0);
}
imagejpeg($im, $upload_path . $filename);
imagedestroy($im); // Free memory after processing
}
/* Set custom price to cart item */
function roomeo_custom_price_to_cart_item($cart_object) {
if (!WC()->session->__isset("reload_checkout")) {
foreach ($cart_object->cart_contents as $key => $value) {
if (isset($value["custom_price"])) {
$value['data']->set_price($value["custom_price"]);
}
}
}
}
add_action('woocommerce_before_calculate_totals', 'roomeo_custom_price_to_cart_item', 99);
// Ensure cart item data consistency
add_action('woocommerce_add_cart_item_data', 'roomeo_bulk_products_addtocart', 10, 3);
function roomeo_bulk_products_addtocart($cart_item_data, $product_id, $variation_id){
if (!isset($cart_item_data['attach_url'])) {
$total_price = get_post_meta($product_id, '_sample_price', true);
$img_url = wp_get_attachment_url(get_post_thumbnail_id($product_id));
$cart_item_data['attach_url'] = $img_url;
$cart_item_data['set_price'] = $total_price;
}
return $cart_item_data;
}
// Add order item meta
add_action('woocommerce_add_order_item_meta', 'roomeo_add_order_item_meta', 10, 3);
function roomeo_add_order_item_meta($item_id, $cart_item, $cart_item_key) {
$meta_fields = [
'ProductID' => 'ProductID',
'height' => 'Height',
'width' => 'Width',
'img_type' => 'Filter Type',
'total_size' => 'Total Size',
'product_type'=> 'Product Type',
'attach_url' => 'Wallpaper'
];
foreach ($meta_fields as $key => $label) {
if (isset($cart_item[$key])) {
wc_add_order_item_meta($item_id, __($label, 'aoim'), $cart_item[$key]);
}
}
}
Tropical Flamingo Paradise Wall Art - Roomeo
Write any image name, category or tag here...
Sorry, we didn't find this image in our database, maybe you can try some other words?
Tropical Flamingo Paradise Wall Art Transform your space with this stunning wall art featuring two elegant flamingos in a lush tropical garden. The vibrant colors and intricate details will add a touch of exotic beauty to your home decor. Complementary colors to consider are shades of pink, green, and earth tones to enhance the overall aesthetic appeal of your space.
Add to Wishlist
Save
€ 38.00 / m²
Enter Wallpaper Dimensions
Free Delivery on orders over €150
Estimated 3-5 day Turnaround
200gsm Non-Woven Wallpaper
Eco friendly FSC Certified paper
Paste included with every order
Easy Installation & removal
Paid sample pre-printed with design of choice
€ 15.00
Free generic material sample
€ 0.00 / m²
Artisanal Satin Finish Wallpaper
All our wall murals are printed with a smooth and non-reflective satin finish.
Perfect to add a little bit of personal flare to your home.
Easy To install
To quickly bring you
from concept to creation!
Eco - Friendly
Forest Stewardship Council
Certified Material
Washable
Easy to clean with a
damp cloth
Long Lasting
Non-shrinking Wallpaper
for timeless masterpieces